Convert SQL into DQL (Doctrine2) with join table -



Convert SQL into DQL (Doctrine2) with join table -

similar questions exist, found none mentionning silent bring together table problem.

i have simple sql query bring together can't convert dql, because of bring together table. there 2 entities, shop , client, linked manytomany association.

doctrine2 silently made bring together table: shop_client.

now, if want all clients not belong given shop simlpy do:

select c.name `client` c bring together `shop_client` sc on sc.client_id = c.id , sc.shop_id != :shop_id

this straight forward, easy, cannot come dql version.

i tried utilize "exists", "not in", "size" never end working dql query.

edit: shop entity has clients field, client entity has no shops field.

select c client c c.id in ( select c2.id shop s2 bring together s2.clients c2 s2.id != :shopid )

also, consider building such queries without entity definitions shooting in dark. post them question next time.

doctrine2 dql jointable

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -