{"action":"created","issue":{"url":"https://api.github.com/repos/cakephp/cakephp/issues/7489","labels_url":"https://api.github.com/repos/cakephp/cakephp/issues/7489/labels{/name}","comments_url":"https://api.github.com/repos/cakephp/cakephp/issues/7489/comments","events_url":"https://api.github.com/repos/cakephp/cakephp/issues/7489/events","html_url":"https://github.com/cakephp/cakephp/issues/7489","id":109186212,"number":7489,"title":"Nested contain doesn't work across servers","user":{"login":"plopzer","id":14914224,"avatar_url":"https://avatars.githubusercontent.com/u/14914224?v=3","gravatar_id":"","url":"https://api.github.com/users/plopzer","html_url":"https://github.com/plopzer","followers_url":"https://api.github.com/users/plopzer/followers","following_url":"https://api.github.com/users/plopzer/following{/other_user}","gists_url":"https://api.github.com/users/plopzer/gists{/gist_id}","starred_url":"https://api.github.com/users/plopzer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plopzer/subscriptions","organizations_url":"https://api.github.com/users/plopzer/orgs","repos_url":"https://api.github.com/users/plopzer/repos","events_url":"https://api.github.com/users/plopzer/events{/privacy}","received_events_url":"https://api.github.com/users/plopzer/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-09-30T21:48:08Z","updated_at":"2015-09-30T22:13:06Z","closed_at":"2015-09-30T21:49:34Z","body":"In cake2 I could use containable to associate tables across servers like this and it would run seperate queries and stitch it together in php.\r\n\r\n    class User extends AppModel {\r\n        public $useDbConfig = 'server1';\r\n        public $hasMany = array('Point');\r\n    }\r\n    class Point extends AppModel {\r\n        public $useDbConfig = 'server2';\r\n        public $belongsTo = array('Region');\r\n    }\r\n    class Region extends AppModel {\r\n        public $useDbConfig = 'server1';\r\n    }\r\n\r\n    $this->User->find('all', array('contain' => array('Point' => array('Region'))));\r\n\r\nBut in cake3 when I try the same thing it tries to do a join in sql which obviously throws an error \"Base table or view not found: 1146 Table 'server2.regions' doesn't exist\".\r\n\r\n    class UsersTable extends Table {\r\n        public static function defaultConnectionName() {\r\n            return 'server1';\r\n        }\r\n        public function initialize(array $config) {\r\n            $this->hasMany('Points');\r\n        }\r\n    }\r\n    class PointsTable extends Table {\r\n        public static function defaultConnectionName() {\r\n            return 'server2';\r\n        }\r\n        public function initialize(array $config) {\r\n            $this->belongsTo('Regions');\r\n        }\r\n    }\r\n    class RegionsTable extends Table {\r\n        public static function defaultConnectionName() {\r\n            return 'server1';\r\n        }\r\n    }\r\n\r\n    $this->Users->find()->contain(['Points' => ['Regions']]);\r\n\r\nIt does work when you only go 1 level deep though\r\n\r\n    $this->Users->find()->contain(['Points']);"},"comment":{"url":"https://api.github.com/repos/cakephp/cakephp/issues/comments/144559235","html_url":"https://github.com/cakephp/cakephp/issues/7489#issuecomment-144559235","issue_url":"https://api.github.com/repos/cakephp/cakephp/issues/7489","id":144559235,"user":{"login":"plopzer","id":14914224,"avatar_url":"https://avatars.githubusercontent.com/u/14914224?v=3","gravatar_id":"","url":"https://api.github.com/users/plopzer","html_url":"https://github.com/plopzer","followers_url":"https://api.github.com/users/plopzer/followers","following_url":"https://api.github.com/users/plopzer/following{/other_user}","gists_url":"https://api.github.com/users/plopzer/gists{/gist_id}","starred_url":"https://api.github.com/users/plopzer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plopzer/subscriptions","organizations_url":"https://api.github.com/users/plopzer/orgs","repos_url":"https://api.github.com/users/plopzer/repos","events_url":"https://api.github.com/users/plopzer/events{/privacy}","received_events_url":"https://api.github.com/users/plopzer/received_events","type":"User","site_admin":false},"created_at":"2015-09-30T22:13:06Z","updated_at":"2015-09-30T22:13:06Z","body":"Oh I see, if they were on the same host you could join them. Is it possible to specify the strategy in the relationship definition?"}}