Hello,
I obviously not fully understood what this ‘hot potatoe’ flag implies in our requests.
@rrd, really helped me here, but I again found the problem with the below request.
It seems that I have to list in the group() statement all fields I list in select().
I tried but I still get the error.
$unlocked_sites = $this->Agthemes->find()
->select([
'id',
'site_id',
'audioguide_id',
])
->contain([
'DeviceConnections' => function ($q) {
return $q
->select(['id', 'agtheme_id', 'request'])
->where(['request' => 'unlock']);
}
])
->matching('DeviceConnections', function ($q) {
return $q
->select(['id', 'agtheme_id', 'request'])
->where(
[
'request' => 'unlock',
]);
})
->distinct('agtheme_id')
->group([
'site_id', 'id', 'audioguide_id', 'DeviceConnections.id','DeviceConnections.agtheme.id', 'DeviceConnections.request'
])
->toArray();
Error is:
2017-08-21 10:27:13 Error: [PDOException] SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #4 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘ndguide.DeviceConnections.id’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
Hum well, subsidiary question: Is it a good choice to run mySQL 5.7 with current CakePHP 3 version??
Alain