createQuery('SELECT u.id ...">

Is the Doctrine2 "MEMBER OF" clause valid for a MySQL database?

Doctrine2 DQL allows you to use 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 offer supported by the MySQL database?

Also, with emphasis on the previous example, is this the $ group identifier for the Group object or an instance of the Group object itself?

+5
source share
2 answers

MEMBER OFis a pure ORM offer and has nothing to do with DBAL, so it should work with any suppliers.

MEMBER OFmust accept the object, but may also accept identifier.

+4
source

SQL, MEMBER OF:

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 = ?
       )

Doctrine MEMBER OF SQL

+3

All Articles