{"action":"created","comment":{"url":"https://api.github.com/repos/cakephp/cakephp/pulls/comments/40946078","id":40946078,"diff_hunk":"@@ -134,6 +185,47 @@ public function saveAssociated(EntityInterface $entity, array $options = [])\n     }\n \n     /**\n+     * Deletes/sets null the related objects according to the dependency between source and targets and foreign key nullability\n+     *\n+     * @param array $properties array of foreignKey properties\n+     * @param EntityInterface $entity the entity which should have its associated entities unassigned\n+     * @param Table $target The associated table\n+     * @param array $options original list of options passed in constructor\n+     * @return void\n+     */\n+    protected function _unlinkAssociated(array $properties, EntityInterface $entity, Table $target, array $options)\n+    {\n+        $mustBeDependent = (!$this->_foreignKeyAcceptsNull($target, $properties) || $this->dependent());\n+        $this->dependent($mustBeDependent);\n+\n+        if ($mustBeDependent) {\n+                $this->cascadeDelete($entity, $options);\n+        } else {\n+            $updateFields = array_fill_keys(array_keys($properties), null);\n+            $target->updateAll($updateFields, $properties);\n+        }\n+    }\n+\n+    /**\n+     * Checks the nullable flag of the foreign key\n+     *\n+     * @param Table $table the table containing the foreign key\n+     * @param array $properties the list of fields that compose the foreign key\n+     * @return bool\n+     */\n+    protected function _foreignKeyAcceptsNull(Table $table, array $properties)\n+    {\n+        return array_product(","path":"src/ORM/Association/HasMany.php","position":122,"original_position":122,"commit_id":"85a2e8c84fc23e955c213bc372eb465262802422","original_commit_id":"85a2e8c84fc23e955c213bc372eb465262802422","user":{"login":"mylux","id":11030522,"avatar_url":"https://avatars.githubusercontent.com/u/11030522?v=3","gravatar_id":"","url":"https://api.github.com/users/mylux","html_url":"https://github.com/mylux","followers_url":"https://api.github.com/users/mylux/followers","following_url":"https://api.github.com/users/mylux/following{/other_user}","gists_url":"https://api.github.com/users/mylux/gists{/gist_id}","starred_url":"https://api.github.com/users/mylux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mylux/subscriptions","organizations_url":"https://api.github.com/users/mylux/orgs","repos_url":"https://api.github.com/users/mylux/repos","events_url":"https://api.github.com/users/mylux/events{/privacy}","received_events_url":"https://api.github.com/users/mylux/received_events","type":"User","site_admin":false},"body":"Do you think it is better to make a cast to boolean?","created_at":"2015-10-01T18:06:33Z","updated_at":"2015-10-01T18:06:33Z","html_url":"https://github.com/cakephp/cakephp/pull/7477#discussion_r40946078","pull_request_url":"https://api.github.com/repos/cakephp/cakephp/pulls/7477","_links":{"self":{"href":"https://api.github.com/repos/cakephp/cakephp/pulls/comments/40946078"},"html":{"href":"https://github.com/cakephp/cakephp/pull/7477#discussion_r40946078"},"pull_request":{"href":"https://api.github.com/repos/cakephp/cakephp/pulls/7477"}}},"pull_request":{"url":"https://api.github.com/repos/cakephp/cakephp/pulls/7477","id":46230728,"html_url":"https://github.com/cakephp/cakephp/pull/7477","diff_url":"https://github.com/cakephp/cakephp/pull/7477.diff","patch_url":"https://github.com/cakephp/cakephp/pull/7477.patch","issue_url":"https://api.github.com/repos/cakephp/cakephp/issues/7477","number":7477,"state":"open","locked":false,"title":"Implemented feature discussed in #7462","user":{"login":"mylux","id":11030522,"avatar_url":"https://avatars.githubusercontent.com/u/11030522?v=3","gravatar_id":"","url":"https://api.github.com/users/mylux","html_url":"https://github.com/mylux","followers_url":"https://api.github.com/users/mylux/followers","following_url":"https://api.github.com/users/mylux/following{/other_user}","gists_url":"https://api.github.com/users/mylux/gists{/gist_id}","starred_url":"https://api.github.com/users/mylux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mylux/subscriptions","organizations_url":"https://api.github.com/users/mylux/orgs","repos_url":"https://api.github.com/users/mylux/repos","events_url":"https://api.github.com/users/mylux/events{/privacy}","received_events_url":"https://api.github.com/users/mylux/received_events","type":"User","site_admin":false},"body":"PR as discussed in #7462 ","created_at":"2015-09-29T02:32:11Z","updated_at":"2015-10-01T18:06:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"03ca8961ae841bdd5cd64b7c70186f3da79e0405","assignee":null,"milestone":{"url":"https://api.github.com/repos/cakephp/cakephp/milestones/60","html_url":"https://github.com/cakephp/cakephp/milestones/3.1.1","labels_url":"https://api.github.com/repos/cakephp/cakephp/milestones/60/labels","id":1314897,"number":60,"title":"3.1.1","description":"Bugfixes and minor enhancements 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":36,"closed_issues":43,"state":"open","created_at":"2015-09-20T02:24:50Z","updated_at":"2015-10-01T17:38:14Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/cakephp/cakephp/pulls/7477/commits","review_comments_url":"https://api.github.com/repos/cakephp/cakephp/pulls/7477/comments","review_comment_url":"https://api.github.com/repos/cakephp/cakephp/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cakephp/cakephp/issues/7477/comments","statuses_url":"https://api.github.com/repos/cakephp/cakephp/statuses/85a2e8c84fc23e955c213bc372eb465262802422","head":{"label":"mylux:issue-7462","ref":"issue-7462","sha":"85a2e8c84fc23e955c213bc372eb465262802422","user":{"login":"mylux","id":11030522,"avatar_url":"https://avatars.githubusercontent.com/u/11030522?v=3","gravatar_id":"","url":"https://api.github.com/users/mylux","html_url":"https://github.com/mylux","followers_url":"https://api.github.com/users/mylux/followers","following_url":"https://api.github.com/users/mylux/following{/other_user}","gists_url":"https://api.github.com/users/mylux/gists{/gist_id}","starred_url":"https://api.github.com/users/mylux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mylux/subscriptions","organizations_url":"https://api.github.com/users/mylux/orgs","repos_url":"https://api.github.com/users/mylux/repos","events_url":"https://api.github.com/users/mylux/events{/privacy}","received_events_url":"https://api.github.com/users/mylux/received_events","type":"User","site_admin":false},"repo":{"id":43277823,"name":"cakephp","full_name":"mylux/cakephp","owner":{"login":"mylux","id":11030522,"avatar_url":"https://avatars.githubusercontent.com/u/11030522?v=3","gravatar_id":"","url":"https://api.github.com/users/mylux","html_url":"https://github.com/mylux","followers_url":"https://api.github.com/users/mylux/followers","following_url":"https://api.github.com/users/mylux/following{/other_user}","gists_url":"https://api.github.com/users/mylux/gists{/gist_id}","starred_url":"https://api.github.com/users/mylux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mylux/subscriptions","organizations_url":"https://api.github.com/users/mylux/orgs","repos_url":"https://api.github.com/users/mylux/repos","events_url":"https://api.github.com/users/mylux/events{/privacy}","received_events_url":"https://api.github.com/users/mylux/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mylux/cakephp","description":"CakePHP: The Rapid Development Framework for PHP - Official Repository","fork":true,"url":"https://api.github.com/repos/mylux/cakephp","forks_url":"https://api.github.com/repos/mylux/cakephp/forks","keys_url":"https://api.github.com/repos/mylux/cakephp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mylux/cakephp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mylux/cakephp/teams","hooks_url":"https://api.github.com/repos/mylux/cakephp/hooks","issue_events_url":"https://api.github.com/repos/mylux/cakephp/issues/events{/number}","events_url":"https://api.github.com/repos/mylux/cakephp/events","assignees_url":"https://api.github.com/repos/mylux/cakephp/assignees{/user}","branches_url":"https://api.github.com/repos/mylux/cakephp/branches{/branch}","tags_url":"https://api.github.com/repos/mylux/cakephp/tags","blobs_url":"https://api.github.com/repos/mylux/cakephp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mylux/cakephp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mylux/cakephp/git/refs{/sha}","trees_url":"https://api.github.com/repos/mylux/cakephp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mylux/cakephp/statuses/{sha}","languages_url":"https://api.github.com/repos/mylux/cakephp/languages","stargazers_url":"https://api.github.com/repos/mylux/cakephp/stargazers","contributors_url":"https://api.github.com/repos/mylux/cakephp/contributors","subscribers_url":"https://api.github.com/repos/mylux/cakephp/subscribers","subscription_url":"https://api.github.com/repos/mylux/cakephp/subscription","commits_url":"https://api.github.com/repos/mylux/cakephp/commits{/sha}","git_commits_url":"https://api.github.com/repos/mylux/cakephp/git/commits{/sha}","comments_url":"https://api.github.com/repos/mylux/cakephp/comments{/number}","issue_comment_url":"https://api.github.com/repos/mylux/cakephp/issues/comments{/number}","contents_url":"https://api.github.com/repos/mylux/cakephp/contents/{+path}","compare_url":"https://api.github.com/repos/mylux/cakephp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mylux/cakephp/merges","archive_url":"https://api.github.com/repos/mylux/cakephp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mylux/cakephp/downloads","issues_url":"https://api.github.com/repos/mylux/cakephp/issues{/number}","pulls_url":"https://api.github.com/repos/mylux/cakephp/pulls{/number}","milestones_url":"https://api.github.com/repos/mylux/cakephp/milestones{/number}","notifications_url":"https://api.github.com/repos/mylux/cakephp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mylux/cakephp/labels{/name}","releases_url":"https://api.github.com/repos/mylux/cakephp/releases{/id}","created_at":"2015-09-28T03:25:51Z","updated_at":"2015-09-28T03:26:07Z","pushed_at":"2015-10-01T04:09:45Z","git_url":"git://github.com/mylux/cakephp.git","ssh_url":"git@github.com:mylux/cakephp.git","clone_url":"https://github.com/mylux/cakephp.git","svn_url":"https://github.com/mylux/cakephp","homepage":"http://cakephp.org","size":87640,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"cakephp:master","ref":"master","sha":"ef79994219ea15f9b22fbd2537638c738d5ddc3f","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-10-01T12:22:04Z","pushed_at":"2015-10-01T17:38:14Z","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":185117,"stargazers_count":6082,"watchers_count":6082,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":2756,"mirror_url":null,"open_issues_count":147,"forks":2756,"open_issues":147,"watchers":6082,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cakephp/cakephp/pulls/7477"},"html":{"href":"https://github.com/cakephp/cakephp/pull/7477"},"issue":{"href":"https://api.github.com/repos/cakephp/cakephp/issues/7477"},"comments":{"href":"https://api.github.com/repos/cakephp/cakephp/issues/7477/comments"},"review_comments":{"href":"https://api.github.com/repos/cakephp/cakephp/pulls/7477/comments"},"review_comment":{"href":"https://api.github.com/repos/cakephp/cakephp/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cakephp/cakephp/pulls/7477/commits"},"statuses":{"href":"https://api.github.com/repos/cakephp/cakephp/statuses/85a2e8c84fc23e955c213bc372eb465262802422"}}}}