我只是想知道如何做這樣的事情在doctrine2沒有針對多場DQL Doctrine2
select
e
from
\Entity e
where
e.field1, e.field2 NOT IN (select e2.field1, e2.field2 from \Entity e2 where condition)
當我做到這一點還是我周圍用括號我得到了一個錯誤,如在兩個領域:
QueryException: [Syntax Error] line 0, col 136: Error: Expected Doctrine\ORM\Query\Lexer::T_CLOSE_PARENTHESIS, got ','
或:
QueryException: [Syntax Error] line 0, col 135: Error: Expected =, <, <=, <>, >, >=, !=, got ','
PHP代碼:
$query = $this->_em->createQuery('
SELECT r FROM LibrairieBundle\Entity\Reseau r
WHERE (r.client1 = :me or r.client2 = :me) and r.confirme = 1
and (r.client2, r.client1) not in (
select s.clientFrom, s.clientObject from LibrairieBundle\Entity\SuggestClient s
where s.clientTo = :cible
)
');
你能告訴我們你有這個查詢的原則代碼嗎? – cheesemacfly 2013-05-04 21:05:00
當然,客體是爲了找回我的朋友,並建議他們給朋友。和列表中不應該包含朋友,我已經建議他們給我的朋友xD它的編碼有點$ query = $ this - > _ em-> createQuery('SELECT r FROM LibrairieBundle \ Entity \ Reseau r WHERE(r.client1 = :me或r.client2 =:me)和r.confirme = 1和(r.client2,r.client1)不在(從sg_clientFrom中,從LibrairieBundle \ Entity \ SuggestClient s中選擇s.clientObject,其中s.clientTo = cible)'); – 2013-05-05 11:19:01
當您完全使用評論中的代碼時,會生成什麼查詢? – cheesemacfly 2013-05-05 15:58:56