-
-
Notifications
You must be signed in to change notification settings - Fork 99
Closed
Description
I'm trying to link an article document with other articles. I'd rather not link an article with itself, so I try to write my first ODM query, with the helper in sonata admin :
$this->createQuery()
->where()
->not()
->same($this->getSubject()->getId(), 'a')
->end()
->end()
->getQuery()
This produces the following query:
SELECT * FROM [nt:unstructured] AS a
WHERE (
NOT
ISSAMENODE(a, ['/articles/mon deuxieme article'])
AND
(a.[phpcr:class] = 'Cine\DbBundle\Document\Article' OR a.[phpcr:classparents] = 'Cine\DbBundle\Document\Article'))
The AND
operator seems to have higher priority because I can get what I want when trying the following request :
SELECT * FROM [nt:unstructured] AS a
WHERE (
(NOT
ISSAMENODE(a, ['/articles/mon deuxieme article']) )
AND
(a.[phpcr:class] = 'Cine\DbBundle\Document\Article' OR a.[phpcr:classparents] = 'Cine\DbBundle\Document\Article'))
Notice the extra couple of parenthesis.
- I think this is a bug
- I would like to know if I could somehow generate the second request with the query builder
Metadata
Metadata
Assignees
Labels
No labels