title: YEAR(CURDATE() in DQL (Doctrine Query Language)
body: <p>In <code>MySQL</code> there is <code>YEAR(CURDATE()</code>. </p>
  
  <pre><code>mysql&gt; SELECT YEAR(CURDATE());
  +-----------------+
  | YEAR(CURDATE()) |
  +-----------------+
  |            2017 |
  +-----------------+
  </code></pre>
  
  <p>How to obtain it in DQL? In directly usage</p>
  
  <pre><code>$er-&gt;createQueryBuilder('s')
     -&gt;where('s.year = YEAR(CURDATE()');
  </code></pre>
  
  <p>I obtaining:</p>
  
  <pre><code>[Syntax Error] line 0, col 105: Error: Expected known function, got 'YEAR'
  </code></pre>
  
  <p>I trying </p>
  
  <pre><code>SUBSTRING(CURDATE(),1,4);
  </code></pre>
  
  <p>that again works correctly in pure MySQL, but in DQL I have now error</p>
  
  <pre><code>[Syntax Error] line 0, col 115: Error: Expected known function, got 'CURDATE'
  </code></pre>
  
  <p>Similar results give:</p>
  
  <pre><code>SUBSTRING(NOW(),1,4);
  </code></pre>
  
  <p>I mean it works in MySQL, but in doctrine end with exception:</p>
  
  <pre><code>[Syntax Error] line 0, col 115: Error: Expected known function, got 'NOW'
  </code></pre>