{"action":"created","comment":{"url":"https://api.github.com/repos/cakephp/cakephp/pulls/comments/24283334","id":24283334,"diff_hunk":"@@ -170,6 +171,43 @@ public function testTarget()\n     }\n \n     /**\n+     * Tests that target() returns the correct Table object for plugins\n+     *\n+     * @return void\n+     */\n+    public function testTargetPlugin()\n+    {\n+        Plugin::load('TestPlugin');\n+\n+        $config = [\n+            'className' => 'TestPlugin.Comments',\n+            'foreignKey' => 'a_key',\n+            'conditions' => ['field' => 'value'],\n+            'dependent' => true,\n+            'sourceTable' => $this->source,\n+            'joinType' => 'INNER'\n+        ];\n+        $this->association = $this->getMock(\n+            '\\Cake\\ORM\\Association',\n+            [\n+                '_options', 'attachTo', '_joinCondition', 'cascadeDelete', 'isOwningSide',\n+                'saveAssociated', 'eagerLoader', 'type'\n+            ],\n+            ['ThisAssociationName', $config]","path":"tests/TestCase/ORM/AssociationTest.php","position":34,"original_position":34,"commit_id":"bf6ee7d4ae09fe79519c4f84be840d538c0c14e2","original_commit_id":"bf6ee7d4ae09fe79519c4f84be840d538c0c14e2","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},"body":"Why are you using a mock here?","created_at":"2015-02-07T00:37:43Z","updated_at":"2015-02-07T00:37:43Z","html_url":"https://github.com/cakephp/cakephp/pull/5836#discussion_r24283334","pull_request_url":"https://api.github.com/repos/cakephp/cakephp/pulls/5836","_links":{"self":{"href":"https://api.github.com/repos/cakephp/cakephp/pulls/comments/24283334"},"html":{"href":"https://github.com/cakephp/cakephp/pull/5836#discussion_r24283334"},"pull_request":{"href":"https://api.github.com/repos/cakephp/cakephp/pulls/5836"}}},"pull_request":{"url":"https://api.github.com/repos/cakephp/cakephp/pulls/5836","id":28715553,"html_url":"https://github.com/cakephp/cakephp/pull/5836","diff_url":"https://github.com/cakephp/cakephp/pull/5836.diff","patch_url":"https://github.com/cakephp/cakephp/pull/5836.patch","issue_url":"https://api.github.com/repos/cakephp/cakephp/issues/5836","number":5836,"state":"open","locked":false,"title":"The plugin alias should not be ignored","user":{"login":"AD7six","id":33387,"avatar_url":"https://avatars.githubusercontent.com/u/33387?v=3","gravatar_id":"","url":"https://api.github.com/users/AD7six","html_url":"https://github.com/AD7six","followers_url":"https://api.github.com/users/AD7six/followers","following_url":"https://api.github.com/users/AD7six/following{/other_user}","gists_url":"https://api.github.com/users/AD7six/gists{/gist_id}","starred_url":"https://api.github.com/users/AD7six/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AD7six/subscriptions","organizations_url":"https://api.github.com/users/AD7six/orgs","repos_url":"https://api.github.com/users/AD7six/repos","events_url":"https://api.github.com/users/AD7six/events{/privacy}","received_events_url":"https://api.github.com/users/AD7six/received_events","type":"User","site_admin":false},"body":"I realize this might be contested (since it was intentional functionality), but allowing fuzzy-alias matching is problematic, and IMO propogating developer error - which the framework shouldn't be doing.\r\n\r\nThe scenario which brought me here was this:\r\n\r\n![gc](https://cloud.githubusercontent.com/assets/33387/6059085/f73b2d70-ad2d-11e4-93b6-ed7a5013f17f.png)\r\n\r\nThe error actually came from debug kit:\r\n\r\n```\r\n2015-02-05 10:22:07 Error: [BadMethodCallException] Unknown method \"gc\"\r\nRequest URL: /\r\nStack Trace:\r\n#0 vendor/cakephp/debug_kit/src/Routing/Filter/DebugBarFilter.php(187): Cake\\ORM\\Table->__call('gc', Array)\r\n#1 vendor/cakephp/debug_kit/src/Routing/Filter/DebugBarFilter.php(187): Api\\Model\\Table\\RequestsTable->gc()\r\n#2 vendor/cakephp/cakephp/src/Event/EventManager.php(380): DebugKit\\Routing\\Filter\\DebugBarFilter->afterDispatch(Object(Cake\\Event\\Event), Object(Cake\\Network\\Request), Object(Cake\\Network\\Response))\r\n#3 vendor/cakephp/cakephp/src/Event/EventManager.php(346): Cake\\Event\\EventManager->_callListener(Array, Object(Cake\\Event\\Event))\r\n#4 vendor/cakephp/cakephp/src/Event/EventManagerTrait.php(78): Cake\\Event\\EventManager->dispatch(Object(Cake\\Event\\Event))\r\n#5 vendor/cakephp/cakephp/src/Routing/Dispatcher.php(92): Cake\\Routing\\Dispatcher->dispatchEvent('Dispatcher.afte...', Array)\r\n#6 webroot/index.php(37): Cake\\Routing\\Dispatcher->dispatch(Object(Cake\\Network\\Request), Object(Cake\\Network\\Response))\r\n#7 {main}\r\n```\r\n\r\nBecause [these lines of code](https://github.com/cakephp/debug_kit/blob/3.0/src/Routing/Filter/DebugBarFilter.php#L186-L187):\r\n\r\n```\r\n$requests = TableRegistry::get('DebugKit.Requests');\r\n$requests->gc();\r\n```\r\n\r\nDid _not_ return the table class from debug kit, but instead from my own Api plugin. I would expect this to be an ongoing problem since namespaces aught to eliminate the need for loose-alias matching.\r\n\r\nSo, should we use table aliases plugin-prefixed within the table registry?","created_at":"2015-02-05T11:01:33Z","updated_at":"2015-02-07T00:37:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e29a23e4a77c2aeb0ac7d83322648592f785a8b2","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cakephp/cakephp/pulls/5836/commits","review_comments_url":"https://api.github.com/repos/cakephp/cakephp/pulls/5836/comments","review_comment_url":"https://api.github.com/repos/cakephp/cakephp/pulls/comments/{number}","comments_url":"https://api.github.com/repos/cakephp/cakephp/issues/5836/comments","statuses_url":"https://api.github.com/repos/cakephp/cakephp/statuses/bf6ee7d4ae09fe79519c4f84be840d538c0c14e2","head":{"label":"cakephp:3.0-table-registry-alias","ref":"3.0-table-registry-alias","sha":"bf6ee7d4ae09fe79519c4f84be840d538c0c14e2","user":{"login":"cakephp","id":23666,"avatar_url":"https://avatars.githubusercontent.com/u/23666?v=3","gravatar_id":"","url":"https://api.github.com/users/cakephp","html_url":"https://github.com/cakephp","followers_url":"https://api.github.com/users/cakephp/followers","following_url":"https://api.github.com/users/cakephp/following{/other_user}","gists_url":"https://api.github.com/users/cakephp/gists{/gist_id}","starred_url":"https://api.github.com/users/cakephp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cakephp/subscriptions","organizations_url":"https://api.github.com/users/cakephp/orgs","repos_url":"https://api.github.com/users/cakephp/repos","events_url":"https://api.github.com/users/cakephp/events{/privacy}","received_events_url":"https://api.github.com/users/cakephp/received_events","type":"Organization","site_admin":false},"repo":{"id":656494,"name":"cakephp","full_name":"cakephp/cakephp","owner":{"login":"cakephp","id":23666,"avatar_url":"https://avatars.githubusercontent.com/u/23666?v=3","gravatar_id":"","url":"https://api.github.com/users/cakephp","html_url":"https://github.com/cakephp","followers_url":"https://api.github.com/users/cakephp/followers","following_url":"https://api.github.com/users/cakephp/following{/other_user}","gists_url":"https://api.github.com/users/cakephp/gists{/gist_id}","starred_url":"https://api.github.com/users/cakephp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cakephp/subscriptions","organizations_url":"https://api.github.com/users/cakephp/orgs","repos_url":"https://api.github.com/users/cakephp/repos","events_url":"https://api.github.com/users/cakephp/events{/privacy}","received_events_url":"https://api.github.com/users/cakephp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cakephp/cakephp","description":"CakePHP: The Rapid Development Framework for PHP - Official Repository","fork":false,"url":"https://api.github.com/repos/cakephp/cakephp","forks_url":"https://api.github.com/repos/cakephp/cakephp/forks","keys_url":"https://api.github.com/repos/cakephp/cakephp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cakephp/cakephp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cakephp/cakephp/teams","hooks_url":"https://api.github.com/repos/cakephp/cakephp/hooks","issue_events_url":"https://api.github.com/repos/cakephp/cakephp/issues/events{/number}","events_url":"https://api.github.com/repos/cakephp/cakephp/events","assignees_url":"https://api.github.com/repos/cakephp/cakephp/assignees{/user}","branches_url":"https://api.github.com/repos/cakephp/cakephp/branches{/branch}","tags_url":"https://api.github.com/repos/cakephp/cakephp/tags","blobs_url":"https://api.github.com/repos/cakephp/cakephp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cakephp/cakephp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cakephp/cakephp/git/refs{/sha}","trees_url":"https://api.github.com/repos/cakephp/cakephp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cakephp/cakephp/statuses/{sha}","languages_url":"https://api.github.com/repos/cakephp/cakephp/languages","stargazers_url":"https://api.github.com/repos/cakephp/cakephp/stargazers","contributors_url":"https://api.github.com/repos/cakephp/cakephp/contributors","subscribers_url":"https://api.github.com/repos/cakephp/cakephp/subscribers","subscription_url":"https://api.github.com/repos/cakephp/cakephp/subscription","commits_url":"https://api.github.com/repos/cakephp/cakephp/commits{/sha}","git_commits_url":"https://api.github.com/repos/cakephp/cakephp/git/commits{/sha}","comments_url":"https://api.github.com/repos/cakephp/cakephp/comments{/number}","issue_comment_url":"https://api.github.com/repos/cakephp/cakephp/issues/comments/{number}","contents_url":"https://api.github.com/repos/cakephp/cakephp/contents/{+path}","compare_url":"https://api.github.com/repos/cakephp/cakephp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cakephp/cakephp/merges","archive_url":"https://api.github.com/repos/cakephp/cakephp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cakephp/cakephp/downloads","issues_url":"https://api.github.com/repos/cakephp/cakephp/issues{/number}","pulls_url":"https://api.github.com/repos/cakephp/cakephp/pulls{/number}","milestones_url":"https://api.github.com/repos/cakephp/cakephp/milestones{/number}","notifications_url":"https://api.github.com/repos/cakephp/cakephp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cakephp/cakephp/labels{/name}","releases_url":"https://api.github.com/repos/cakephp/cakephp/releases{/id}","created_at":"2010-05-08T14:38:22Z","updated_at":"2015-02-06T23:26:38Z","pushed_at":"2015-02-06T16:31:42Z","git_url":"git://github.com/cakephp/cakephp.git","ssh_url":"git@github.com:cakephp/cakephp.git","clone_url":"https://github.com/cakephp/cakephp.git","svn_url":"https://github.com/cakephp/cakephp","homepage":"http://cakephp.org","size":150766,"stargazers_count":5481,"watchers_count":5481,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":2428,"mirror_url":null,"open_issues_count":123,"forks":2428,"open_issues":123,"watchers":5481,"default_branch":"master"}},"base":{"label":"cakephp:3.0","ref":"3.0","sha":"74b97c76946bc331e3cf6b7d7658dd334bf3d61c","user":{"login":"cakephp","id":23666,"avatar_url":"https://avatars.githubusercontent.com/u/23666?v=3","gravatar_id":"","url":"https://api.github.com/users/cakephp","html_url":"https://github.com/cakephp","followers_url":"https://api.github.com/users/cakephp/followers","following_url":"https://api.github.com/users/cakephp/following{/other_user}","gists_url":"https://api.github.com/users/cakephp/gists{/gist_id}","starred_url":"https://api.github.com/users/cakephp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cakephp/subscriptions","organizations_url":"https://api.github.com/users/cakephp/orgs","repos_url":"https://api.github.com/users/cakephp/repos","events_url":"https://api.github.com/users/cakephp/events{/privacy}","received_events_url":"https://api.github.com/users/cakephp/received_events","type":"Organization","site_admin":false},"repo":{"id":656494,"name":"cakephp","full_name":"cakephp/cakephp","owner":{"login":"cakephp","id":23666,"avatar_url":"https://avatars.githubusercontent.com/u/23666?v=3","gravatar_id":"","url":"https://api.github.com/users/cakephp","html_url":"https://github.com/cakephp","followers_url":"https://api.github.com/users/cakephp/followers","following_url":"https://api.github.com/users/cakephp/following{/other_user}","gists_url":"https://api.github.com/users/cakephp/gists{/gist_id}","starred_url":"https://api.github.com/users/cakephp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cakephp/subscriptions","organizations_url":"https://api.github.com/users/cakephp/orgs","repos_url":"https://api.github.com/users/cakephp/repos","events_url":"https://api.github.com/users/cakephp/events{/privacy}","received_events_url":"https://api.github.com/users/cakephp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cakephp/cakephp","description":"CakePHP: The Rapid Development Framework for PHP - Official Repository","fork":false,"url":"https://api.github.com/repos/cakephp/cakephp","forks_url":"https://api.github.com/repos/cakephp/cakephp/forks","keys_url":"https://api.github.com/repos/cakephp/cakephp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cakephp/cakephp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cakephp/cakephp/teams","hooks_url":"https://api.github.com/repos/cakephp/cakephp/hooks","issue_events_url":"https://api.github.com/repos/cakephp/cakephp/issues/events{/number}","events_url":"https://api.github.com/repos/cakephp/cakephp/events","assignees_url":"https://api.github.com/repos/cakephp/cakephp/assignees{/user}","branches_url":"https://api.github.com/repos/cakephp/cakephp/branches{/branch}","tags_url":"https://api.github.com/repos/cakephp/cakephp/tags","blobs_url":"https://api.github.com/repos/cakephp/cakephp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cakephp/cakephp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cakephp/cakephp/git/refs{/sha}","trees_url":"https://api.github.com/repos/cakephp/cakephp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cakephp/cakephp/statuses/{sha}","languages_url":"https://api.github.com/repos/cakephp/cakephp/languages","stargazers_url":"https://api.github.com/repos/cakephp/cakephp/stargazers","contributors_url":"https://api.github.com/repos/cakephp/cakephp/contributors","subscribers_url":"https://api.github.com/repos/cakephp/cakephp/subscribers","subscription_url":"https://api.github.com/repos/cakephp/cakephp/subscription","commits_url":"https://api.github.com/repos/cakephp/cakephp/commits{/sha}","git_commits_url":"https://api.github.com/repos/cakephp/cakephp/git/commits{/sha}","comments_url":"https://api.github.com/repos/cakephp/cakephp/comments{/number}","issue_comment_url":"https://api.github.com/repos/cakephp/cakephp/issues/comments/{number}","contents_url":"https://api.github.com/repos/cakephp/cakephp/contents/{+path}","compare_url":"https://api.github.com/repos/cakephp/cakephp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cakephp/cakephp/merges","archive_url":"https://api.github.com/repos/cakephp/cakephp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cakephp/cakephp/downloads","issues_url":"https://api.github.com/repos/cakephp/cakephp/issues{/number}","pulls_url":"https://api.github.com/repos/cakephp/cakephp/pulls{/number}","milestones_url":"https://api.github.com/repos/cakephp/cakephp/milestones{/number}","notifications_url":"https://api.github.com/repos/cakephp/cakephp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cakephp/cakephp/labels{/name}","releases_url":"https://api.github.com/repos/cakephp/cakephp/releases{/id}","created_at":"2010-05-08T14:38:22Z","updated_at":"2015-02-06T23:26:38Z","pushed_at":"2015-02-06T16:31:42Z","git_url":"git://github.com/cakephp/cakephp.git","ssh_url":"git@github.com:cakephp/cakephp.git","clone_url":"https://github.com/cakephp/cakephp.git","svn_url":"https://github.com/cakephp/cakephp","homepage":"http://cakephp.org","size":150766,"stargazers_count":5481,"watchers_count":5481,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":2428,"mirror_url":null,"open_issues_count":123,"forks":2428,"open_issues":123,"watchers":5481,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cakephp/cakephp/pulls/5836"},"html":{"href":"https://github.com/cakephp/cakephp/pull/5836"},"issue":{"href":"https://api.github.com/repos/cakephp/cakephp/issues/5836"},"comments":{"href":"https://api.github.com/repos/cakephp/cakephp/issues/5836/comments"},"review_comments":{"href":"https://api.github.com/repos/cakephp/cakephp/pulls/5836/comments"},"review_comment":{"href":"https://api.github.com/repos/cakephp/cakephp/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/cakephp/cakephp/pulls/5836/commits"},"statuses":{"href":"https://api.github.com/repos/cakephp/cakephp/statuses/bf6ee7d4ae09fe79519c4f84be840d538c0c14e2"}}}}