title: select count of records group by month in cakephp 3
body: <p>I'm using <code>CakePHP 3.x+</code></p>
  
  <p>I have to show a graph on the page and thus want to build script for that.</p>
  
  <p>I have to select count of records group by month for current year.</p>
  
  <p>This is what I have tried.</p>
  
  <pre><code>$graph = $this-&gt;GenerateVideos-&gt;find()
          -&gt;select('COUNT(id)', 'MONTH(created)')
          -&gt;where(['YEAR(created)' =&gt; date('Y')])
          -&gt;group(['MONTH(created)']);
  </code></pre>
  
  <p>which generates sql like</p>
  
  <pre><code>'sql' =&gt; 'SELECT GenerateVideos.COUNT(id) AS GenerateVideos__COUNT(`id`) FROM generate_videos GenerateVideos WHERE YEAR(created) = :c0 GROUP BY MONTH(created) ',
  'params' =&gt; [
      ':c0' =&gt; [
          'value' =&gt; '2018',
          'type' =&gt; null,
          'placeholder' =&gt; 'c0'
      ]
  ],
  </code></pre>
  
  <p><strong>But this is giving error as</strong></p>
  
  <pre><code>Error: SQLSTATE[42000]: Syntax error or access violation: 
  1064 You have an error in your SQL syntax; check the manual that 
  corresponds to your MySQL server version for the right syntax to use near '(`id`) 
  FROM generate_videos GenerateVideos WHERE YEAR(created) = '2018' GROUP BY' at line 1 
  </code></pre>