createQuery("select p.name from blogBundle:Person p
where p.id not in(select c.person from blogBundle:Category c)")->execute();
And I'm getting this error:
Error: Invalid PathExpression. Must be a StateFieldPathExpression
createQuery("select p.name from blogBundle:Person p
where p.id not in(select c.person from blogBundle:Category c)")->execute();
And I'm getting this error:
Error: Invalid PathExpression. Must be a StateFieldPathExpression
Change your DQL by:
SELECT p
FROM blogBundle:Person p
WHERE p.id NOT IN(
SELECT IDENTITY(p.id)
FROM blogBundle:Category c
JOIN c.person p)
Note the IDENTITY
.
The problem is ->execute()
. To run Query you need to use getResult()
.
The correct form is:
$this->getEntityManager()->createQuery("select p.name from blogBundle:Person p
where p.id not in(select c.person from blogBundle:Category c)")->getResult();