Hi, thanks for your help. Now I'm trying to select all user who don't have any relation.
I have written it and it seems working well, but I don't understand why it need to use b.id, because b.id doesn't exist. Can you help me again? 'SELECT u FROM AcmeUserBundle:User u LEFT JOIN u.relClients b WHERE u.roles LIKE :roles AND b.id IS NULL' Thanks Regards Il giorno martedì 27 maggio 2014 18:12:19 UTC+1, Nebumix ha scritto: > > Amazing, now it is working, thanks a lot. > > Il giorno martedì 27 maggio 2014 17:58:21 UTC+1, Marco Pivetta ha scritto: >> >> Hi, >> >> You are trying to use SQL-ish syntax in DQL. >> >> DQL does not work with column names, but with properties of your objects. >> >> The correct query is something like: >> >> SELECT u FROM AcmeUserBundle:User u LEFT JOIN u.relBrokers b WHERE u.id= :id >> >> >> Marco Pivetta >> >> http://twitter.com/Ocramius >> >> http://ocramius.github.com/ >> >> >> On 27 May 2014 18:51, Nebumix <[email protected]> wrote: >> >>> Hi, I have a self referencing relationship on a entity class, using >>> symfony 2. >>> >>> This is my class: http://pastebin.com/HFCYg7qt >>> >>> It created a table with the relation, with two primary key and two >>> fields: broker_id, client_id >>> >>> I'm trying to filter a query >>> >>> http://pastebin.com/vPC4BVYS >>> >>> but I have this error, I can't understand what is the problem. >>> >>> [Semantical Error] line 0, col 69 near 'client_id = ': Error: Class >>> Acme\UserBundle\Entity\User has no field or association named client_id >>> Thanks for the help >>> Regards >>> >>> -- >>> 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. >>> >> >> -- 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.
