I've just been playing around, and ended up providing the alias as part of 
the activeSuppliersCriteria method which is working.

But... with the QueryBuilder I'm getting a Product that thinks it has a 
complete collection for Suppliers now. Is this expected behaviour using 
QueryBuilder and a filtering Criteria?

I get the same thing if I use a filtered join
->join('p.suppliers', 's', Join::WITH, 's.enabled = 1')

So I assume it's expected? I've seen you mention something about a broken 
entity graph, I guess this is what you mean?

Thanks, Cameron


On Monday, 10 July 2017 15:40:44 UTC+12, Cameron Junge wrote:
>
> Hi Marco,
>
> Thanks for the response. I have one more question:
>
> I see with Criteria that it's possible to use with both 'matching" and 
> QueryBuilder.
>
> Am I correct in saying that a single Criteria (say, 
> Product::activeSuppliersCriteria) can't be reused between 
> Product::suppliers->matching(Product::activeSuppliersCriteria())
>
> and 
> QueryBuilder::select('p', 's')->from(Product::class, 'p')->join(
> 'p.suppliers', 's')->addCriteria(
> Product::activeSuppliersCriteria())
> ?
>
> I've tried experimenting and found that the QueryBuilder way needs an 
> alias, while the alias causes the matching to fail. Be nice to be able to 
> reuse the Criteria around what an "active supplier" is.
>
> Cameron
>

-- 
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