Converting sql to dql
<p>I have a problem converting a sql query to dql. 
Can anyone help me.</p>

<p>This is what i got so far: </p>

<pre><code>$query = $this-&gt;em-&gt;createQuery("
        UPDATE MyBundle:Tree AS n
        JOIN MyBundle:Tree AS movingNode ON movingNode.id = :node
        JOIN MyBundle:Tree AS parentNode ON parentNode.id = :parent
        SET
        n.lft = n.lft +
            IF (parentNode.lft &lt; movingNode.lft,
                 IF (n.lft &gt;= movingNode.rgt + 1, 0,
                        IF (n.lft &gt;= movingNode.lft, parentNode.lft - movingNode.lft + 1,
                                IF (n.lft &gt;= parentNode.lft + 1, movingNode.rgt - movingNode.lft + 1 , 0
                                    )
                            )
                     ),
                 IF (n.lft &gt;= parentNode.lft + 1, 0,
                        IF (n.lft &gt;= movingNode.rgt + 1, -movingNode.rgt + movingNode.lft - 1,
                                IF (n.lft &gt;= movingNode.lft, parentNode.lft - movingNode.rgt, 0
                                    )
                            )
                     )
                ),
        n.rgt = n.rgt +
            IF (parentNode.lft &lt; movingNode.lft,
                 IF (n.rgt &gt;= movingNode.rgt + 1, 0,
                        IF (n.rgt &gt;= movingNode.lft, parentNode.lft - movingNode.lft + 1,
                                IF (n.rgt &gt;= parentNode.lft + 1, movingNode.rgt - movingNode.lft + 1 , 0
                                    )
                            )
                     ),
                 IF (n.rgt &gt;= parentNode.lft + 1, 0,
                        IF (n.rgt &gt;= movingNode.rgt + 1, -movingNode.rgt + movingNode.lft - 1,
                                IF (n.rgt &gt;= movingNode.lft, parentNode.lft - movingNode.rgt, 0
                                    )
                            )
                     )
                )
        WHERE parentNode.lft &lt; movingNode.lft OR parentNode.lft &gt; movingNode.rgt;
    ")-&gt;setParameter('node', $node)-&gt;setParameter('parent', $parent);
</code></pre>

<p>It seems like i need to split it into subquerys or in more querys. Iam not shure.</p>

<p>Also it seems like there isent support for update and join in dql.</p>