Doctrine 2 UPDATE with LEFT JOIN

前端 未结 1 1364
粉色の甜心
粉色の甜心 2021-01-19 02:51

SELECT - all right, no errors

$em = $this->get(\'doctrine.orm.entity_manager\');

$query = $em->createQuery(\"
    SELECT c
    FROM MyDemoBundle:Categ         


        
相关标签:
1条回答
  • 2021-01-19 03:31

    LEFT JOIN, or JOINs in particular are only supported in UPDATE statements of MySQL. DQL abstracts a subset of common ansi sql, so this is not possible. Try with a subselect:

    UPDATE MyDemoBundle:Category c SET c.isActive = false WHERE ?1 MEMBER OF c.projects;
    

    (MEMBER OF is actually turning into a subselect here). I am not 100% sure if this works, but it is more likeli than the join.

    0 讨论(0)
提交回复
热议问题