{"action":"opened","issue":{"url":"https://api.github.com/repos/cakephp/cakephp/issues/6866","labels_url":"https://api.github.com/repos/cakephp/cakephp/issues/6866/labels{/name}","comments_url":"https://api.github.com/repos/cakephp/cakephp/issues/6866/comments","events_url":"https://api.github.com/repos/cakephp/cakephp/issues/6866/events","html_url":"https://github.com/cakephp/cakephp/issues/6866","id":90437586,"number":6866,"title":"3.0.7 - Weirdness with patchEntity when the associated table has a contain","user":{"login":"patrickconroy","id":954577,"avatar_url":"https://avatars.githubusercontent.com/u/954577?v=3","gravatar_id":"","url":"https://api.github.com/users/patrickconroy","html_url":"https://github.com/patrickconroy","followers_url":"https://api.github.com/users/patrickconroy/followers","following_url":"https://api.github.com/users/patrickconroy/following{/other_user}","gists_url":"https://api.github.com/users/patrickconroy/gists{/gist_id}","starred_url":"https://api.github.com/users/patrickconroy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patrickconroy/subscriptions","organizations_url":"https://api.github.com/users/patrickconroy/orgs","repos_url":"https://api.github.com/users/patrickconroy/repos","events_url":"https://api.github.com/users/patrickconroy/events{/privacy}","received_events_url":"https://api.github.com/users/patrickconroy/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-06-23T16:52:11Z","updated_at":"2015-06-23T16:52:11Z","closed_at":null,"body":"Hello. I scoured my emails to see if this ever happened to anyone else, but couldn't find anything. If..\r\n1. I have a `PostsTable` which belongsToMany `TagsTable`.\r\n2. `TagsTable` hasOne `TagsTranslations`\r\n3. `TagsTable` has a `findAll` method that contains `TagsTranslations`\r\n4. I try to find a `PostsTable` record and do a `patchEntity` on the `PostsTable`, I get:\r\n\r\n``\r\nError: SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'id' in where clause is ambiguous\r\n``\r\n\r\nBecause the marshaller creates this SQL:\r\n```\r\nSELECT `Tags`.`id` AS `Tags__id`, `Tags`.`family` AS `Tags__family`, `Tags`.`priority` AS `Tags__priority`, `TagsTranslations`.`id` AS `TagsTranslations__id`, `TagsTranslations`.`locale` AS `TagsTranslations__locale`, `TagsTranslations`.`name` AS `TagsTranslations__name`\r\nFROM `tags` `Tags`\r\nLEFT JOIN `tags_translations` `TagsTranslations` ON `Tags`.`id` = (`TagsTranslations`.`tag_id`)\r\nWHERE `id` = 1\r\n```\r\n\r\nController..\r\n```\r\n$post = $this->Posts->get(52406);\r\n$this->Posts->patchEntity($post, ['tags' => [\r\n    ['id' => 1]\r\n]]);\r\n```\r\n\r\nTagsTable..\r\n```\r\npublic function initialize(array $config)\r\n{\t\r\n\tparent::initialize($config);\r\n\t$this->hasOne('TagsTranslations');\r\n}\r\npublic function findAll(Query $query, array $options = [])\r\n{\r\n\t$query->contain(['TagsTranslations']);\r\n\treturn $query;\r\n}\r\n```\r\n\r\nPostsTable..\r\n```\r\npublic function initialize(array $config)\r\n{\r\n\tparent::initialize($config);\r\n\t$this->addAssociations([\r\n\t\t'belongsToMany' => ['Tags']\r\n\t]);\r\n}\r\n```\r\n\r\nIf my `TagsTable` doesn't do that contain, the `patchEntity` is fine, but it seems like something that should work either way. Let me know if I'm going crazy and there's another error I'm missing. I went back in time in git and it seems like this issue has always happened.\r\n\r\nThanks"}}