在 NOT IN 语句中查询 Doctrine

Query inside NOT IN statement Doctrine

我在代码中找到了这句话:

        $dql
            = <<<DQL
SELECT u FROM AppBundle:User u
JOIN u.Roles r
JOIN u.team t
WHERE u.id NOT IN (
      SELECT user.id
      FROM GameBundle:Goal g
      JOIN g.user user
      WHERE
        g.objective = :objective
    )
  AND 
    r.profile = :sales_profile
  AND 
    r.company = :company
  AND 
    u.onlyStatus NOT IN (:status)
DQL;

我不知道如何在 NOT IN 句子中进行查询,请帮助我。

我需要知道:

SELECT u FROM AppBundle:User u
JOIN u.Roles r
JOIN u.team t
WHERE u.id NOT IN (
      SELECT user.id
      FROM GameBundle:Goal g
      JOIN g.user user
      WHERE
        g.objective = :objective
    )

这意味着在 'Goal' table.

当前没有 'objective' 的所有用户

这是您需要的吗?