Symfony/Doctrine2SQL
で 2 つのエンティティを使用してステートメントを実行すると問題が発生します。
$qb = $this->getEntityManager()->createQueryBuilder();
$qb->select('s')
->from('basecomProductionWorkflowBaseBundle:SubprocessData', 's')
->leftJoin('basecomProductionWorkflowBaseBundle:ReleaseDay', 'r', Expr\Join::WITH, 'r.id = s.releaseDay')
->where(
$qb->expr()->andX(
$qb->expr()->eq('r.date', ':date'),
$qb->expr()->isNotNull('r.edition')
)
)
->setParameter('date', $date);
次のエラー メッセージが表示されました。
[Semantical Error] line 0, col 124 near 'r WITH r.id =': Error: Identification Variable basecomProductionWorkflowBaseBundle:ReleaseDay used in join path expression but was not defined before.
PS: 両方のテーブルは互いに関係がありません (別の問題を解決するための回避策です)。phpmyadmin で同じステートメントをテストしました。