The Criteria API currently doesn't support matching associations values. You'll 
have to use a DQL query for this.

--  
Jasper N. Brouwer
(@jaspernbrouwer)


On 20 November 2014 at 14:51:59, Jordi Martínez ([email protected]) wrote:
> Hi,
>  
> I have this entities:
>  
> > /** @Entity */
> class Person
> {
> /** @Id @GeneratedValue @Column(type="integer") */
> private id;
>  
> /** @Column(type="string") */
> private passport;
> ...
> }
> ?>
>  
> > /** @Entity */
> class Contract
> {
> @ManyToOne(targetEntity="Person")
> private person;
> ...
> }
>  
>  
>  
> Can I retrieve all Contracts that have a Person with a passport containing
> 'xyz'?
>  
> This is, can I 'findby' entities filtering by a field of an entity that is
> a field of the 'findbyed' entity?
>  
> I've see I can do:
>  
> $criteria = Criteria::create()->where(Criteria::expr()->eq("Person", "456"  
> ));
> $oEntityManager->getRepository('Contract')->matching($criteria);
>  
>  
> But this filter by Person id. I've searched a lot but can't find how to
> filter by Person.passport.
>  
> Thats a lot!
>  
> JordiM


-- 
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 http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to