1
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 mistake:
Error: Invalid PathExpression. Must be a StateFieldPathExpression
1
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 mistake:
Error: Invalid PathExpression. Must be a StateFieldPathExpression
0
The problem is the ->execute()
. To run the Query you need to use the 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();
0
Trade your DQL for:
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
.
Browser other questions tagged php symfony-2 symfony
You are not signed in. Login or sign up in order to post.