{"action":"created","issue":{"url":"https://api.github.com/repos/cakephp/cakephp/issues/5982","labels_url":"https://api.github.com/repos/cakephp/cakephp/issues/5982/labels{/name}","comments_url":"https://api.github.com/repos/cakephp/cakephp/issues/5982/comments","events_url":"https://api.github.com/repos/cakephp/cakephp/issues/5982/events","html_url":"https://github.com/cakephp/cakephp/issues/5982","id":59324016,"number":5982,"title":"Translation not work with foreign_key = 1","user":{"login":"Angyo","id":1088341,"avatar_url":"https://avatars.githubusercontent.com/u/1088341?v=3","gravatar_id":"","url":"https://api.github.com/users/Angyo","html_url":"https://github.com/Angyo","followers_url":"https://api.github.com/users/Angyo/followers","following_url":"https://api.github.com/users/Angyo/following{/other_user}","gists_url":"https://api.github.com/users/Angyo/gists{/gist_id}","starred_url":"https://api.github.com/users/Angyo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Angyo/subscriptions","organizations_url":"https://api.github.com/users/Angyo/orgs","repos_url":"https://api.github.com/users/Angyo/repos","events_url":"https://api.github.com/users/Angyo/events{/privacy}","received_events_url":"https://api.github.com/users/Angyo/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/cakephp/cakephp/labels/Defect","name":"Defect","color":"f7c6c7"}],"state":"closed","locked":false,"assignee":{"login":"lorenzo","id":37621,"avatar_url":"https://avatars.githubusercontent.com/u/37621?v=3","gravatar_id":"","url":"https://api.github.com/users/lorenzo","html_url":"https://github.com/lorenzo","followers_url":"https://api.github.com/users/lorenzo/followers","following_url":"https://api.github.com/users/lorenzo/following{/other_user}","gists_url":"https://api.github.com/users/lorenzo/gists{/gist_id}","starred_url":"https://api.github.com/users/lorenzo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lorenzo/subscriptions","organizations_url":"https://api.github.com/users/lorenzo/orgs","repos_url":"https://api.github.com/users/lorenzo/repos","events_url":"https://api.github.com/users/lorenzo/events{/privacy}","received_events_url":"https://api.github.com/users/lorenzo/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/cakephp/cakephp/milestones/7","html_url":"https://github.com/cakephp/cakephp/milestones/3.0.0","labels_url":"https://api.github.com/repos/cakephp/cakephp/milestones/7/labels","id":453043,"number":7,"title":"3.0.0","description":"New major release that breaks compatibility with 2.x\r\n\r\n- PHP5.4.19+\r\n- New ORM & behaviors.\r\n- Improved Routing\r\n- PSR-0 and composer support.\r\n- Simpler configuration and bootstrapping.\r\n- Improved configuration handling.\r\n- Improved bake.\r\n\r\nSee [the roadmap](http://github.com/cakephp/cakephp/wiki/3.0-roadmap) for more details.","creator":{"login":"lh-import","id":5175817,"avatar_url":"https://avatars.githubusercontent.com/u/5175817?v=3","gravatar_id":"","url":"https://api.github.com/users/lh-import","html_url":"https://github.com/lh-import","followers_url":"https://api.github.com/users/lh-import/followers","following_url":"https://api.github.com/users/lh-import/following{/other_user}","gists_url":"https://api.github.com/users/lh-import/gists{/gist_id}","starred_url":"https://api.github.com/users/lh-import/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lh-import/subscriptions","organizations_url":"https://api.github.com/users/lh-import/orgs","repos_url":"https://api.github.com/users/lh-import/repos","events_url":"https://api.github.com/users/lh-import/events{/privacy}","received_events_url":"https://api.github.com/users/lh-import/received_events","type":"User","site_admin":false},"open_issues":21,"closed_issues":2362,"state":"open","created_at":"2013-10-11T20:56:23Z","updated_at":"2015-03-01T20:02:25Z","due_on":"2015-03-22T04:00:00Z","closed_at":null},"comments":18,"created_at":"2015-02-28T04:00:29Z","updated_at":"2015-03-01T20:02:25Z","closed_at":"2015-03-01T20:02:25Z","body":"I added the following code.\r\n\r\nIn my Database, contentbuilders table\r\n\r\nid | type | parent_id | lft | rght\r\n---|------|-----------|-----|-----\r\n1|1|NULL|1|2\r\n2|2|NULL|3|4\r\n3|2|NULL|5|6\r\n\r\nIn i18n table\r\n\r\nid | locale | model | foreign_key | field | content\r\n---|--------|-------|-------------|-------|--------\r\n1|en_US|Contentbuilders|1|name|Main Menu\r\n2|fr_FR|Contentbuilders|1|name|Menu principal\r\n3|en_US|Contentbuilders|3|name|En Test\r\n4|fr_FR|Contentbuilders|3|name|Fr Test\r\n\r\nIn my ContentbuildersController\r\n\r\n    public function index()\r\n    {\r\n        $contentbuilders = $this->Contentbuilders->find('threaded')->find('translations');\r\n        $this->set('contentbuilders', $contentbuilders);\r\n    }\r\n\r\nIn my view template\r\n\r\n    <?php foreach($contentbuilders as $contentbuilder): ?>\r\n        <p>Type : <?= $contentbuilder->type ?> | <?= $contentbuilder->translation('fr_FR')->name ?></p>\r\n    <?php endforeach; ?>\r\n\r\nWith this code, data from I18n table are null for foreign_key = 1, but work if i update theses entries with foreign = 2. This seemed strange to me and I prefer therefore postpone the problem here."},"comment":{"url":"https://api.github.com/repos/cakephp/cakephp/issues/comments/76627259","html_url":"https://github.com/cakephp/cakephp/issues/5982#issuecomment-76627259","issue_url":"https://api.github.com/repos/cakephp/cakephp/issues/5982","id":76627259,"user":{"login":"lorenzo","id":37621,"avatar_url":"https://avatars.githubusercontent.com/u/37621?v=3","gravatar_id":"","url":"https://api.github.com/users/lorenzo","html_url":"https://github.com/lorenzo","followers_url":"https://api.github.com/users/lorenzo/followers","following_url":"https://api.github.com/users/lorenzo/following{/other_user}","gists_url":"https://api.github.com/users/lorenzo/gists{/gist_id}","starred_url":"https://api.github.com/users/lorenzo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lorenzo/subscriptions","organizations_url":"https://api.github.com/users/lorenzo/orgs","repos_url":"https://api.github.com/users/lorenzo/repos","events_url":"https://api.github.com/users/lorenzo/events{/privacy}","received_events_url":"https://api.github.com/users/lorenzo/received_events","type":"User","site_admin":false},"created_at":"2015-03-01T20:02:25Z","updated_at":"2015-03-01T20:02:25Z","body":"Closing as there is a pull request open"}}