title: Doctrine_Query is automatically pick additional columns because of that group by is not working symfony
body: <p><strong><em>This is my query builder</em></strong> </p>
  
  <p>$query = Doctrine_Query:: create()</p>
  
  <pre><code>                -&gt;select('e.crowd_pm_id as pmId,a.employee_id,sum((TIMESTAMPDIFF(MINUTE, a.punch_in_user_time, a.punch_out_user_time)/60)) AS as durationCount')
                  -&gt;from('AttendanceRecord a')
                  -&gt;leftJoin('a.Employee e')
                  -&gt;addWhere("a.punch_in_user_time &gt;=  '". $searchClues['punchInUserTime']."'")
                  -&gt;addWhere("a.punch_out_user_time &lt;= '".$searchClues['punchOutUserTime'] ."' OR a.punch_out_user_time IS NULL")
                  -&gt;andWhere('e.crowd_pm_id IS NOT NULL')
                  -&gt;groupBy('e.crowd_pm_id , a.employee_id');
  </code></pre>
  
  <p><strong><em>Out put should be</em></strong> </p>
  
  <pre><code>SELECT h.crowd_pm_id as pmId,o.employee_id, SUM((TIMESTAMPDIFF(MINUTE, o.punch_in_user_time, o.punch_out_user_time)/60)) AS o__1 FROM ohrm_attendance_record o LEFT JOIN hs_hr_employee h ON o.employee_id = h.emp_number WHERE (o.punch_in_user_time &gt;= '2017-01-26' AND (o.punch_out_user_time &lt;= '2017-01-27' OR o.punch_out_user_time IS NULL) AND h.crowd_pm_id IS NOT NULL) GROUP BY h.crowd_pm_id , o.employee_id
  </code></pre>
  
  <p><strong><em>Error message that I get</em></strong></p>
  
  <blockquote>
    <p>Blockquote : 
    SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'intcrowd_db.o.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by. Failing Query: "SELECT o.id AS o__id, o.employee_id AS o__employee_id, h.emp_number AS h__emp_number, h.crowd_pm_id AS h__0, h.crowd_pm_id AS h__0, SUM((TIMESTAMPDIFF(MINUTE, o.punch_in_user_time, o.punch_out_user_time)/60)) AS o__1 FROM ohrm_attendance_record o LEFT JOIN hs_hr_employee h ON o.employee_id = h.emp_number WHERE (o.punch_in_user_time >= '2017-01-19' AND (o.punch_out_user_time &lt;= '2017-01-20' OR o.punch_out_user_time IS NULL) AND h.crowd_pm_id IS NOT NULL) GROUP BY h.crowd_pm_id , o.employee_id"</p>
  </blockquote>
  
  <pre><code>(Their is additional columns in the query that auto picked up)
  </code></pre>
  
  <p>I'm using wamp</p>
  
  <ol>
  <li>php version 5.6.25</li>
  <li>mysql version 5.7.14</li>
  <li>symfony version &lt; 1.4</li>
  <li>windows 10</li>
  </ol>