title: Doctrine CASE WHEN
body: <p>I am building an application with Symfony 3.4 and Dcotrine.</p>
  
  <p>The following SQL-Statement is working fine within my database:</p>
  
  <pre><code>SELECT * FROM `report` 
  INNER JOIN report_template ON `template_id` = report_template.id INNER JOIN game ON game.id = `game_id`
  WHERE (game.refereeAId='Hoehl Luca,SpVgg Altenerding' or game.refereeBId='Hoehl Luca,SpVgg Altenerding')
  AND report.creator_id LIKE (CASE WHEN report.template_id=1 THEN 136 ELSE '%' END)
  </code></pre>
  
  <p>Now I want this statement in Doctrine:</p>
  
  <pre><code>$query = $repository-&gt;createQueryBuilder('r');
  $query-&gt;innerjoin('r.game', 'g')
  -&gt;innerjoin('r.template', 't')
  -&gt;innerjoin('r.creator', 'c');
  
  $query-&gt;andwhere('g.refereeAId = :refereeName or g.refereeBId = :refereeName')
        -&gt;andWhere('r.approved = :approved')
        -&gt;andWhere('c.id LIKE CASE WHEN r.template = :template THEN :user ELSE \'%\' END')
        -&gt;setParameter('approved', true)
        -&gt;setParameter('refereeName', $refereeID)
        -&gt;setParameter('template', $templates[1])
        -&gt;setParameter('user', $user-&gt;getId());
  </code></pre>
  
  <p>I get the following error message:</p>
  
  <pre><code>Notice: Undefined property: Doctrine\ORM\Query\AST\GeneralCaseExpression::$type
  </code></pre>
  
  <p>I have tried so many combinations in the LIKE CASE block, nothing worked. Does anybody knows how to add this block in Doctrine?</p>
  
  <p>Best regards
  Andreas</p>