{"action":"opened","issue":{"url":"https://api.github.com/repos/cakephp/cakephp/issues/6528","labels_url":"https://api.github.com/repos/cakephp/cakephp/issues/6528/labels{/name}","comments_url":"https://api.github.com/repos/cakephp/cakephp/issues/6528/comments","events_url":"https://api.github.com/repos/cakephp/cakephp/issues/6528/events","html_url":"https://github.com/cakephp/cakephp/issues/6528","id":74889709,"number":6528,"title":"Containable not working with 'group' option in 2.6.x","user":{"login":"InfinityVoid","id":5890215,"avatar_url":"https://avatars.githubusercontent.com/u/5890215?v=3","gravatar_id":"","url":"https://api.github.com/users/InfinityVoid","html_url":"https://github.com/InfinityVoid","followers_url":"https://api.github.com/users/InfinityVoid/followers","following_url":"https://api.github.com/users/InfinityVoid/following{/other_user}","gists_url":"https://api.github.com/users/InfinityVoid/gists{/gist_id}","starred_url":"https://api.github.com/users/InfinityVoid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/InfinityVoid/subscriptions","organizations_url":"https://api.github.com/users/InfinityVoid/orgs","repos_url":"https://api.github.com/users/InfinityVoid/repos","events_url":"https://api.github.com/users/InfinityVoid/events{/privacy}","received_events_url":"https://api.github.com/users/InfinityVoid/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-05-10T10:34:30Z","updated_at":"2015-05-10T10:34:30Z","closed_at":null,"body":"I use such containable schema:\r\n\r\n\r\n    Rubric->hasMany->RubricCategoryNoveltiesView\r\n    RubricCategoryNoveltiesView->belongTo->Rubric\r\n\r\n    Array\r\n    (\r\n        [Category] => Array\r\n            (\r\n                [conditions] => Array\r\n                    (\r\n                        [Category.id] => 12\r\n                    )\r\n    \r\n            )\r\n        [Article] => Array\r\n            (\r\n                [0] => Photo\r\n                [1] => MainCategory\r\n            )\r\n        [0] => Novelty\r\n        [Slider] => Array\r\n            (\r\n                [0] => Photo\r\n            )\r\n        [RubricSliderArticlesView] => Array\r\n            (\r\n                [order] => RubricSliderArticlesView.article_order DESC\r\n            )\r\n        [RubricCategory] => Array\r\n            (\r\n            )\r\n        [RubricCategoryNoveltiesView] => Array\r\n            (\r\n                [limit] => 4\r\n                [order] => RubricCategoryNoveltiesView.created DESC\r\n                [group] => RubricCategoryNoveltiesView.id\r\n            )\r\n    )\r\n\r\nand there is a problem with RubricCategoryNoveltiesView, when I try to use aggregation function. When I use it, it gaves me an error `Warning: Model \"RubricCategoryNoveltiesView\" is not associated with model \"RubricCategoryNoveltiesView\" in lib\\Cake\\Model\\Behavior\\ContainableBehavior.php on line 342`.\r\n\r\nSo I tried to debug `ContainableBehavior.php`. At line `270` I have tried to add an option `'group'` to `$options = array('className', 'joinTable', 'with', 'foreignKey', 'associationForeignKey', 'conditions', 'fields', 'order', 'limit', 'offset', 'unique', 'finderQuery');`\r\n\r\nIt made Warning dissapear, but SQL querry still don't use GROUP BY statement.\r\n\r\n    SELECT `RubricCategoryNoveltiesView`.`rubric_id`, (...) FROM (...) AS `RubricCategoryNoveltiesView` WHERE `RubricCategoryNoveltiesView`.`rubric_id` = (107) ORDER BY `RubricCategoryNoveltiesView`.`created` DESC LIMIT 4\r\n\r\nI don't have any guess where to debug further."}}