Check if hydrated doctrine result is NULL
- by iggnition
Hi,
I'm trying to check if a result in my DQL is NULL.
I got the following DQL query:
$q = self::createQuery("l")
->select('i.*, s.aantal, m.naam, c.cat_naam, a.app_id')
->from('InstalledBase i, i.Spare s, i.Apparaat a, a.Categorie c, a.Merk m')
->execute();
return $q;
Now i want to check if the s.aantal is NULL so i do:
if(is_null($installedbase->Spare->spare_id))
when the variable is NOT null everything works, but when it is actually NULL i get a E notice message:
Notice: Trying to get property of non-object in \installedbase\templates\_index.php on line 29
It does see that it is null though because the if condition is executed.
Weird thing is i'm doing the exact same thing on another page where it works no problem.
But i must be doing something wrong or stupid since those messages generally don't show for nothing.
So can anybody explain this to me? :)