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
Post a Comment