Actaully, based on your first response, I went back at looked at the 
criteria builder even more and ended up messing around with it and got a 
working example:

$qb = $this->bill_repository->createQueryBuilder('b')
    ->leftJoin('b.favorites', 'f');

$critera = new Criteria();
$critera->where(Criteria::expr()->eq("f.user_id", $user->id));
$critera->orWhere(Criteria::expr()->eq("f.user_id", null));
$qb->addCriteria($critera);


On Tuesday, June 27, 2017 at 12:43:24 AM UTC-5, Marco Pivetta wrote:
>
>  Could you make a more clear example with your currently entity 
> definitions? Keep it minimal, but try showing what the expected result 
> would be like
>
> Marco Pivetta 
>
> http://twitter.com/Ocramius      
>
> http://ocramius.github.com/
>
> On Tue, Jun 27, 2017 at 7:40 AM, Joshua Wilson <[email protected] 
> <javascript:>> wrote:
>
>> I have but I dont quite understand how to work with it, in an ideal world 
>> i'd basically like something like...
>>
>> SELECT a.*, b.* FROM table a LEFT JOIN table b ON b.column = a.column 
>> WITH b.other_column = 1;
>>
>> Basically, at the end of the day, I have a table full of items, users can 
>> favorite those items, but I dont want users to see what each other have 
>> favorited when I display the list of items, I only want the user making the 
>> request to be able to see what items they have favorited. Granted I can 
>> probably loop over the results from the query and check each record and 
>> mark if it was favorited but I already have a one to many relationship 
>> setup between items and favorites and it'd be really nice if I could just 
>> return the single favorite record for the user who is looking at the list 
>> of items
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "doctrine-user" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> Visit this group at https://groups.google.com/group/doctrine-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to