{"action":"created","issue":{"url":"https://api.github.com/repos/cakephp/cakephp/issues/7720","labels_url":"https://api.github.com/repos/cakephp/cakephp/issues/7720/labels{/name}","comments_url":"https://api.github.com/repos/cakephp/cakephp/issues/7720/comments","events_url":"https://api.github.com/repos/cakephp/cakephp/issues/7720/events","html_url":"https://github.com/cakephp/cakephp/issues/7720","id":118256794,"number":7720,"title":"Composite key support is inadequate","user":{"login":"half2me","id":6759894,"avatar_url":"https://avatars.githubusercontent.com/u/6759894?v=3","gravatar_id":"","url":"https://api.github.com/users/half2me","html_url":"https://github.com/half2me","followers_url":"https://api.github.com/users/half2me/followers","following_url":"https://api.github.com/users/half2me/following{/other_user}","gists_url":"https://api.github.com/users/half2me/gists{/gist_id}","starred_url":"https://api.github.com/users/half2me/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/half2me/subscriptions","organizations_url":"https://api.github.com/users/half2me/orgs","repos_url":"https://api.github.com/users/half2me/repos","events_url":"https://api.github.com/users/half2me/events{/privacy}","received_events_url":"https://api.github.com/users/half2me/received_events","type":"User","site_admin":false},"labels":[],"state":"open","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/65","html_url":"https://github.com/cakephp/cakephp/milestones/3.1.5","labels_url":"https://api.github.com/repos/cakephp/cakephp/milestones/65/labels","id":1396949,"number":65,"title":"3.1.5","description":"Bugfixes and optimizations for 3.1.x","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":28,"closed_issues":49,"state":"open","created_at":"2015-11-06T03:58:46Z","updated_at":"2015-11-23T08:21:31Z","due_on":"2015-11-28T05:00:00Z","closed_at":null},"comments":13,"created_at":"2015-11-22T11:08:32Z","updated_at":"2015-11-23T13:21:36Z","closed_at":null,"body":"The Bookmarker tutorial proudly says that \"CakePHP supports composite keys almost everywhere\".\r\n- The Documentation only mentions composite keys in one place, when using it for a primary key.\r\n- There are no naming conventions for composite keys defined in the documentation.\r\n- Cake Bake generates scaffolding code fine, for models using composite primary keys, but any models referencing such a model, using composite foreign keys, are not supported by bake. I can't find any documentation for using composite keys for foreign keys.\r\n\r\nIf CakePHP 3.* supports Composite keys, lets support it properly, and document it, and set naming conventions.\r\n\r\nI would suggest using the same format in the belongsTo array, as we use for the primary key when it is composite:\r\n$this->primaryKey(['id1', 'id2']);\r\n\r\nUse the same syntax for composite foreign keys:\r\n        $this->belongsTo('Parent', [\r\n            'foreignKey' => ['parent_id1', 'parent_id2'],\r\n        ]);\r\n"},"comment":{"url":"https://api.github.com/repos/cakephp/cakephp/issues/comments/158931976","html_url":"https://github.com/cakephp/cakephp/issues/7720#issuecomment-158931976","issue_url":"https://api.github.com/repos/cakephp/cakephp/issues/7720","id":158931976,"user":{"login":"LACabeza","id":2701975,"avatar_url":"https://avatars.githubusercontent.com/u/2701975?v=3","gravatar_id":"","url":"https://api.github.com/users/LACabeza","html_url":"https://github.com/LACabeza","followers_url":"https://api.github.com/users/LACabeza/followers","following_url":"https://api.github.com/users/LACabeza/following{/other_user}","gists_url":"https://api.github.com/users/LACabeza/gists{/gist_id}","starred_url":"https://api.github.com/users/LACabeza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LACabeza/subscriptions","organizations_url":"https://api.github.com/users/LACabeza/orgs","repos_url":"https://api.github.com/users/LACabeza/repos","events_url":"https://api.github.com/users/LACabeza/events{/privacy}","received_events_url":"https://api.github.com/users/LACabeza/received_events","type":"User","site_admin":false},"created_at":"2015-11-23T13:21:36Z","updated_at":"2015-11-23T13:21:36Z","body":"I also had difficulty to deal with composite.\r\nIn the end i created a virtual property on entity to get the composite key concatenated with a semicolon (like \"id1;id2\"), on table class, then on form helper i used that virtual property on a select, and finally i used the beforeMarshal on table class to read the selected option split that value into 2 and set it on the fields i wanted."}}