The Doctrine2 DQL allows for the following SQL:
$query = $em->createQuery('SELECT u.id FROM CmsUser u WHERE :groupId MEMBER OF u.groups');
$query->setParameter('groupId', $group);
$ids = $query->getResult();
Is the MEMBER OF clause supported by a MySQL database?
Moreover, focusing on the previous example, is $group the id of the entity "Group" or is an instance of the "Group" entity itself?
MEMBER OF
is a pure ORM clause and has nothing to with the DBAL
therefor it should work with any vendors.
MEMBER OF
is supposed to accept an Entity but may accept an identifier
too.
I checked SQL
generated with MEMBER OF
clause:
SELECT *fields*
FROM Page p0_
WHERE
EXISTS (
SELECT 1
FROM post_rubric p4_
INNER JOIN Page p3_
ON p4_.rubric_id = p3_.id
WHERE p4_.post_id = p0_.id AND p3_.id = ?
)
Thats a way Doctrine translates MEMBER OF
clause into SQL
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With