I'm using a check to see if findFirst
actually retrieves data. I always use it like this:
$question = Questions::findFirst("uuid = '".$question."'");
if (!$question) {
return $this->respondWithError('No question was found');
}
Now, this always worked for me. But today I found that the code above was triggering the error response, even though the question I was fetching existed. I also found out that if I removed the check, everything would work. I then placed a var_dump()
after findFirst
but before the check and I placed on inside the if-statement. The first one dumped the actual model, the second one dumped a boolean. Anyone have any ideas as to what's going on here?