{"action":"created","issue":{"url":"https://api.github.com/repos/cakephp/cakephp/issues/7818","labels_url":"https://api.github.com/repos/cakephp/cakephp/issues/7818/labels{/name}","comments_url":"https://api.github.com/repos/cakephp/cakephp/issues/7818/comments","events_url":"https://api.github.com/repos/cakephp/cakephp/issues/7818/events","html_url":"https://github.com/cakephp/cakephp/issues/7818","id":121142084,"number":7818,"title":"BTM Association coming up empty, SQL has results on 3.1.5","user":{"login":"AlfranKeith","id":11000277,"avatar_url":"https://avatars.githubusercontent.com/u/11000277?v=3","gravatar_id":"","url":"https://api.github.com/users/AlfranKeith","html_url":"https://github.com/AlfranKeith","followers_url":"https://api.github.com/users/AlfranKeith/followers","following_url":"https://api.github.com/users/AlfranKeith/following{/other_user}","gists_url":"https://api.github.com/users/AlfranKeith/gists{/gist_id}","starred_url":"https://api.github.com/users/AlfranKeith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlfranKeith/subscriptions","organizations_url":"https://api.github.com/users/AlfranKeith/orgs","repos_url":"https://api.github.com/users/AlfranKeith/repos","events_url":"https://api.github.com/users/AlfranKeith/events{/privacy}","received_events_url":"https://api.github.com/users/AlfranKeith/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/cakephp/cakephp/labels/Defect","name":"Defect","color":"f7c6c7"},{"url":"https://api.github.com/repos/cakephp/cakephp/labels/On%20hold","name":"On hold","color":"eb6420"},{"url":"https://api.github.com/repos/cakephp/cakephp/labels/ORM","name":"ORM","color":"ffffff"}],"state":"open","locked":false,"assignee":{"login":"markstory","id":24086,"avatar_url":"https://avatars.githubusercontent.com/u/24086?v=3","gravatar_id":"","url":"https://api.github.com/users/markstory","html_url":"https://github.com/markstory","followers_url":"https://api.github.com/users/markstory/followers","following_url":"https://api.github.com/users/markstory/following{/other_user}","gists_url":"https://api.github.com/users/markstory/gists{/gist_id}","starred_url":"https://api.github.com/users/markstory/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markstory/subscriptions","organizations_url":"https://api.github.com/users/markstory/orgs","repos_url":"https://api.github.com/users/markstory/repos","events_url":"https://api.github.com/users/markstory/events{/privacy}","received_events_url":"https://api.github.com/users/markstory/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/cakephp/cakephp/milestones/68","html_url":"https://github.com/cakephp/cakephp/milestones/3.1.6","labels_url":"https://api.github.com/repos/cakephp/cakephp/milestones/68/labels","id":1434393,"number":68,"title":"3.1.6","description":"Bugfixes and optimizations for the 3.1 branch","creator":{"login":"markstory","id":24086,"avatar_url":"https://avatars.githubusercontent.com/u/24086?v=3","gravatar_id":"","url":"https://api.github.com/users/markstory","html_url":"https://github.com/markstory","followers_url":"https://api.github.com/users/markstory/followers","following_url":"https://api.github.com/users/markstory/following{/other_user}","gists_url":"https://api.github.com/users/markstory/gists{/gist_id}","starred_url":"https://api.github.com/users/markstory/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markstory/subscriptions","organizations_url":"https://api.github.com/users/markstory/orgs","repos_url":"https://api.github.com/users/markstory/repos","events_url":"https://api.github.com/users/markstory/events{/privacy}","received_events_url":"https://api.github.com/users/markstory/received_events","type":"User","site_admin":false},"open_issues":23,"closed_issues":62,"state":"open","created_at":"2015-11-30T03:21:51Z","updated_at":"2015-12-16T02:57:04Z","due_on":"2015-12-22T05:00:00Z","closed_at":null},"comments":8,"created_at":"2015-12-09T01:47:08Z","updated_at":"2015-12-17T03:03:13Z","closed_at":null,"body":"Sorry, new to Cake and have been stumped for days now.\r\nThe opportunities property comes back empty when I query for \r\n`$this->Products->find()->where(['id'=>10])->contain(['Opportunities']);` \r\n\r\nUsing debugkit, I can see that it has SQL generated which returns results but for some reason the property it churns back is empty. The results returned by the generated SQL are what I would expect it to return and contain the proper fields.\r\n\r\nI've mostly just been following the documentation on the site and playing around with the optional keys, so this may just be a simple misunderstanding on my part. Apologies.\r\n\r\nFor table names, that's how the DB has been for years. \r\n\r\n```\r\nclass ProductsTable extends Table {\r\n  public function initialize(array $config){\r\n    $this->table(\"DAS_Products\");\r\n    $this->belongsToMany('Opportunities', [\r\n      'through' => 'OpportunityProducts',\r\n      'className' => 'Opportunities',  \r\n      'targetForeignKey' => 'DAS_Opportunity_id',  \r\n      'foreignKey' => 'DAS_Product_id',\r\n      'strategy'=>'subquery',     \r\n    ]); \r\n  }\r\n```\r\n\r\n```\r\nclass OpportunityProductsTable extends Table {\r\n  public function initialize(array $config){\r\n    $this->table(\"DAS_OpportunityProduct\");\r\n    $this->primaryKey(\"id\");\r\n\r\n \t\t$this->belongsTo(\"Opportunities\", [\r\n      'foreignKey' => 'DAS_Opportunity_id',\r\n      'bindingKey' => 'id'\r\n    ]);\r\n    $this->belongsTo(\"Products\", [\r\n      'foreignKey' => 'DAS_Product_id',    \r\n      'bindingKey' => 'id'\r\n    ]);    \r\n  }\r\n```"},"comment":{"url":"https://api.github.com/repos/cakephp/cakephp/issues/comments/165322418","html_url":"https://github.com/cakephp/cakephp/issues/7818#issuecomment-165322418","issue_url":"https://api.github.com/repos/cakephp/cakephp/issues/7818","id":165322418,"user":{"login":"markstory","id":24086,"avatar_url":"https://avatars.githubusercontent.com/u/24086?v=3","gravatar_id":"","url":"https://api.github.com/users/markstory","html_url":"https://github.com/markstory","followers_url":"https://api.github.com/users/markstory/followers","following_url":"https://api.github.com/users/markstory/following{/other_user}","gists_url":"https://api.github.com/users/markstory/gists{/gist_id}","starred_url":"https://api.github.com/users/markstory/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markstory/subscriptions","organizations_url":"https://api.github.com/users/markstory/orgs","repos_url":"https://api.github.com/users/markstory/repos","events_url":"https://api.github.com/users/markstory/events{/privacy}","received_events_url":"https://api.github.com/users/markstory/received_events","type":"User","site_admin":false},"created_at":"2015-12-17T03:03:13Z","updated_at":"2015-12-17T03:03:13Z","body":"Have you tried `$thing->_matchingData['QueuesSchedules']`?"}}