I am new to Symfony
and I have had a problem with a query. I have two entities that are not directly related: vacation and absence and both have an 'approved' field that is set to 0 by default. What I want is to retrieve all the records whose field approved
is set to 0. I use this query:
SELECT v, a
FROM AppBundle:Vacation v, AppBundle:Absence a
WHERE v.approved = 0 AND a.approved = 0');
And it works perfectly as long as there is at least one record with the field approved
at 0 in both. If in one of them there is no record at 0, it does not return anything. And if I put a OR
instead of AND
in those same circumstances, it returns all the records even if they are at 1. Is there any way to get the result with a single query?
Thanks in advance.