{"action":"created","issue":{"url":"https://api.github.com/repos/j4mie/paris/issues/113","labels_url":"https://api.github.com/repos/j4mie/paris/issues/113/labels{/name}","comments_url":"https://api.github.com/repos/j4mie/paris/issues/113/comments","events_url":"https://api.github.com/repos/j4mie/paris/issues/113/events","html_url":"https://github.com/j4mie/paris/issues/113","id":90109471,"number":113,"title":"belongs_to has a problem with namespace","user":{"login":"lokeb","id":9778706,"avatar_url":"https://avatars.githubusercontent.com/u/9778706?v=3","gravatar_id":"","url":"https://api.github.com/users/lokeb","html_url":"https://github.com/lokeb","followers_url":"https://api.github.com/users/lokeb/followers","following_url":"https://api.github.com/users/lokeb/following{/other_user}","gists_url":"https://api.github.com/users/lokeb/gists{/gist_id}","starred_url":"https://api.github.com/users/lokeb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lokeb/subscriptions","organizations_url":"https://api.github.com/users/lokeb/orgs","repos_url":"https://api.github.com/users/lokeb/repos","events_url":"https://api.github.com/users/lokeb/events{/privacy}","received_events_url":"https://api.github.com/users/lokeb/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-06-22T14:12:45Z","updated_at":"2015-06-22T14:34:53Z","closed_at":null,"body":"I recently moved all my code to a namespace and everything was working okay until I faced the relation belongs_to, and I think it will have problems with other relations as well. My relation is defined as follows in a namespaced model as follows :\r\n```php\r\nnamespace blue;\r\nclass Child extends \\Model {\r\n   public function parent() {\r\n       return $this->belongs_to('Parent');\r\n   }\r\n   public function some_method() {\r\n     $result = $this->parent()->find_one(); \r\n   }\r\n}\r\n```\r\n\r\nOn calling some_method, the belongs_to call requests the registered autoloader for the Parent class, but the autoloader returns blue\\Parent class, which does not serve the purpose for Paris. Paris should rather ask for blue\\Parent. On defining the relation as belongs_to('blue\\Parent'), it does not understand that the class is namespaced and expects blue\\Parent table to be present. This is a serious problem, and has brought down my entire application. Will you please help?"},"comment":{"url":"https://api.github.com/repos/j4mie/paris/issues/comments/114133083","html_url":"https://github.com/j4mie/paris/issues/113#issuecomment-114133083","issue_url":"https://api.github.com/repos/j4mie/paris/issues/113","id":114133083,"user":{"login":"lokeb","id":9778706,"avatar_url":"https://avatars.githubusercontent.com/u/9778706?v=3","gravatar_id":"","url":"https://api.github.com/users/lokeb","html_url":"https://github.com/lokeb","followers_url":"https://api.github.com/users/lokeb/followers","following_url":"https://api.github.com/users/lokeb/following{/other_user}","gists_url":"https://api.github.com/users/lokeb/gists{/gist_id}","starred_url":"https://api.github.com/users/lokeb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lokeb/subscriptions","organizations_url":"https://api.github.com/users/lokeb/orgs","repos_url":"https://api.github.com/users/lokeb/repos","events_url":"https://api.github.com/users/lokeb/events{/privacy}","received_events_url":"https://api.github.com/users/lokeb/received_events","type":"User","site_admin":false},"created_at":"2015-06-22T14:34:53Z","updated_at":"2015-06-22T14:34:53Z","body":"I think there was some problem in me specifying the relation with namespace. It is working after I corrected it. Now, the relations needs to be defined as __NAMESPACE__.'\\Parent', which is okay, but given that the child is contained in blue, shouldn't parent be expected to be contained in blue as well?"}}