Bookmarker Tutorial Error Assistance

I am new to CakePHP and working through the bookmarker tutorial. I have gotten to the step where you are adding a tags.ctp page. When I add the code per the instructions I get the following error.

Error: SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #9 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘cake_bookmarks.BookmarksTags.tag_id’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

I have made no changes to the bookmarks table or to the query. What am I doing wrong? Thanks in advance.

I have found that it is in the grouping of the query and that the newer versions don’t allow. The problem is that I can’t figure out how to correct it. I believe it is in the BookmarksTable.php, is that correct? How do I change the query?

there was a change in mysql 5.7 https://dev.mysql.com/doc/refman/5.7/en/group-by-handling.html so you can:

  1. disable ONLY_FULL_GROUP_BY http://stackoverflow.com/questions/23921117/disable-only-full-group-by
  2. add selected fields to ->group()
  3. change mysql version

Thank you! Item #1 worked. Would you be able to clarify where I would add additional fields to the query grouping. I have been reading documentation and working tutorials and having a really hard time with where that is coming from.

1 Like

http://book.cakephp.org/3.0/en/orm/query-builder.html#aggregates-group-and-having you can add it anywhere in the query before it is executed