{"action":"created","comment":{"url":"https://api.github.com/repos/symfony/symfony/pulls/comments/71675634","id":71675634,"diff_hunk":"@@ -146,6 +195,50 @@ public function testSetValueCallsAdderAndRemoverForNestedCollections()\n         $this->propertyAccessor->setValue($car, 'structure.axes', $axesAfter);\n     }\n \n+    public function testSetValueCallsCustomAdderAndRemoverForCollections()\n+    {\n+        $axesBefore = $this->getContainer(array(1 => 'second', 3 => 'fourth', 4 => 'fifth'));\n+        $axesMerged = $this->getContainer(array(1 => 'first', 2 => 'second', 3 => 'third'));\n+        $axesAfter = $this->getContainer(array(1 => 'second', 5 => 'first', 6 => 'third'));\n+        $axesMergedCopy = is_object($axesMerged) ? clone $axesMerged : $axesMerged;\n+\n+        // Don't use a mock in order to test whether the collections are\n+        // modified while iterating them\n+        $car = new PropertyAccessorCollectionTest_Car($axesBefore);\n+\n+        AnnotationRegistry::registerAutoloadNamespace('Symfony\\Component\\PropertyAccess\\Annotation', __DIR__.'/../../../..');\n+        $this->propertyAccessor = new PropertyAccessor(false, false, null, new LazyLoadingMetadataFactory(new AnnotationLoader(new AnnotationReader())));\n+\n+        $this->propertyAccessor->setValue($car, 'customAxes', $axesMerged);\n+\n+        $this->assertEquals($axesAfter, $car->getCustomAxes());\n+\n+        // The passed collection was not modified\n+        $this->assertEquals($axesMergedCopy, $axesMerged);\n+    }\n+\n+    public function testSetValueCallsCustomAdderAndRemoverForCollectionsMethodAnnotation()\n+    {\n+        $axesBefore = $this->getContainer(array(1 => 'second', 3 => 'fourth', 4 => 'fifth'));\n+        $axesMerged = $this->getContainer(array(1 => 'first', 2 => 'second', 3 => 'third'));\n+        $axesAfter = $this->getContainer(array(1 => 'second', 5 => 'first', 6 => 'third'));\n+        $axesMergedCopy = is_object($axesMerged) ? clone $axesMerged : $axesMerged;\n+\n+        // Don't use a mock in order to test whether the collections are\n+        // modified while iterating them\n+        $car = new PropertyAccessorCollectionTest_Car($axesBefore);\n+\n+        AnnotationRegistry::registerAutoloadNamespace('Symfony\\Component\\PropertyAccess\\Annotation', __DIR__.'/../../../..');","path":"src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php","position":96,"original_position":118,"commit_id":"6b7eeff0953eafcf9e48c67fd1553d68bfc97d6e","original_commit_id":"6b7eeff0953eafcf9e48c67fd1553d68bfc97d6e","user":{"login":"Ener-Getick","id":6871899,"avatar_url":"https://avatars.githubusercontent.com/u/6871899?v=3","gravatar_id":"","url":"https://api.github.com/users/Ener-Getick","html_url":"https://github.com/Ener-Getick","followers_url":"https://api.github.com/users/Ener-Getick/followers","following_url":"https://api.github.com/users/Ener-Getick/following{/other_user}","gists_url":"https://api.github.com/users/Ener-Getick/gists{/gist_id}","starred_url":"https://api.github.com/users/Ener-Getick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ener-Getick/subscriptions","organizations_url":"https://api.github.com/users/Ener-Getick/orgs","repos_url":"https://api.github.com/users/Ener-Getick/repos","events_url":"https://api.github.com/users/Ener-Getick/events{/privacy}","received_events_url":"https://api.github.com/users/Ener-Getick/received_events","type":"User","site_admin":false},"body":"same here","created_at":"2016-07-21T09:38:43Z","updated_at":"2016-07-21T09:38:43Z","html_url":"https://github.com/symfony/symfony/pull/18016#discussion_r71675634","pull_request_url":"https://api.github.com/repos/symfony/symfony/pulls/18016","_links":{"self":{"href":"https://api.github.com/repos/symfony/symfony/pulls/comments/71675634"},"html":{"href":"https://github.com/symfony/symfony/pull/18016#discussion_r71675634"},"pull_request":{"href":"https://api.github.com/repos/symfony/symfony/pulls/18016"}}},"pull_request":{"url":"https://api.github.com/repos/symfony/symfony/pulls/18016","id":61792592,"html_url":"https://github.com/symfony/symfony/pull/18016","diff_url":"https://github.com/symfony/symfony/pull/18016.diff","patch_url":"https://github.com/symfony/symfony/pull/18016.patch","issue_url":"https://api.github.com/repos/symfony/symfony/issues/18016","number":18016,"state":"open","locked":false,"title":"[PropertyAccess] Allow custom methods on property accesses","user":{"login":"lrlopez","id":547387,"avatar_url":"https://avatars.githubusercontent.com/u/547387?v=3","gravatar_id":"","url":"https://api.github.com/users/lrlopez","html_url":"https://github.com/lrlopez","followers_url":"https://api.github.com/users/lrlopez/followers","following_url":"https://api.github.com/users/lrlopez/following{/other_user}","gists_url":"https://api.github.com/users/lrlopez/gists{/gist_id}","starred_url":"https://api.github.com/users/lrlopez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lrlopez/subscriptions","organizations_url":"https://api.github.com/users/lrlopez/orgs","repos_url":"https://api.github.com/users/lrlopez/repos","events_url":"https://api.github.com/users/lrlopez/events{/privacy}","received_events_url":"https://api.github.com/users/lrlopez/received_events","type":"User","site_admin":false},"body":"| Q             | A\r\n| ------------- | ---\r\n| Branch        | master\r\n| Bug fix?      | no\r\n| New feature?  | yes\r\n| BC breaks?    | no\r\n| Deprecations? | no\r\n| Tests pass?   | yes\r\n| Fixed tickets | #5013, #9336, #5219, among others\r\n| License       | MIT\r\n| Doc PR        | https://github.com/symfony/symfony-docs/pull/6400\r\n\r\nSome tests do not pass but failures seem not be related to the changes of this PR.\r\n\r\nSome examples of how to use the new feature:\r\n\r\nAnnotations:\r\n```php\r\n\r\n/**\r\n * @Property(getter=\"getCurrentValue\", setter=\"updateValue\")\r\n */\r\nprotected $value;\r\n\r\n/**\r\n * @Property(adder=\"joinMember\", remover=\"detachMember\")\r\n */\r\nprotected $members;\r\n\r\npublic function getCurrentValue()\r\n{\r\n    return $this->value;\r\n}\r\n\r\npublic function updateValue($newValue)\r\n{\r\n    $this->value = $newValue;\r\n    return $this;\r\n}\r\n\r\npublic function joinMember($newMember)\r\n{\r\n    // Add $newMember to the collection\r\n}\r\n\r\npublic function detachMember($oldMember)\r\n{\r\n    // Remove $oldMember from the collection\r\n}\r\n\r\n/**\r\n * @PropertyGetter(property=\"calculated\")\r\n */\r\npublic function getCalculated()\r\n{\r\n    // whatever...\r\n}\r\n\r\n// You can omit 'property' in method annotations\r\n/**\r\n * @PropertySetter(\"calculated\")\r\n */\r\npublic function setCalculated($calculated)\r\n{\r\n    // whatever...\r\n}\r\n```\r\nYAML:\r\n```YAML\r\n'AppBundle\\Entity\\Example':\r\n  properties:\r\n    value:\r\n      getter: getCurrentValue\r\n      setter: updateValue\r\n    members:\r\n      adder: joinMember\r\n      remover: detachMember\r\n    calculated:\r\n      getter: getCalculated\r\n      setter: setCalculated\r\n```\r\nXML:\r\n```xml\r\n<?xml version=\"1.0\" ?>\r\n\r\n<property-access xmlns=\"http://symfony.com/schema/dic/property-access-mapping\"\r\n                    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\r\n                    xsi:schemaLocation=\"http://symfony.com/schema/dic/property-access-mapping http://symfony.com/schema/dic/property-access-mapping/property-access-mapping-1.0.xsd\">\r\n\r\n    <class name=\"AppBundle\\Entity\\Example\">\r\n        <property name=\"value\" getter=\"getCurrentValue\" setter=\"updateValue\" />\r\n        <property name=\"members\" adder=\"joinMember\" remover=\"detachMember\" />\r\n        <property name=\"calculated\" getter=\"getCalculated\" setter=\"setCalculated\" />\r\n    </class>\r\n\r\n</property-access>\r\n```\r\nCheck-list:\r\n\r\n- [x] Implement YAML & XML mappings\r\n- [x] Address @dunglas and @webmozart comments\r\n- [x] Implement method annotations for virtual properties\r\n- [x] Write documentation","created_at":"2016-03-05T00:43:42Z","updated_at":"2016-07-21T09:38:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dc1c7e9fb92cc34906fc63688cb049dba31bc9dd","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/symfony/symfony/pulls/18016/commits","review_comments_url":"https://api.github.com/repos/symfony/symfony/pulls/18016/comments","review_comment_url":"https://api.github.com/repos/symfony/symfony/pulls/comments{/number}","comments_url":"https://api.github.com/repos/symfony/symfony/issues/18016/comments","statuses_url":"https://api.github.com/repos/symfony/symfony/statuses/6b7eeff0953eafcf9e48c67fd1553d68bfc97d6e","head":{"label":"lrlopez:property-accessor-config","ref":"property-accessor-config","sha":"6b7eeff0953eafcf9e48c67fd1553d68bfc97d6e","user":{"login":"lrlopez","id":547387,"avatar_url":"https://avatars.githubusercontent.com/u/547387?v=3","gravatar_id":"","url":"https://api.github.com/users/lrlopez","html_url":"https://github.com/lrlopez","followers_url":"https://api.github.com/users/lrlopez/followers","following_url":"https://api.github.com/users/lrlopez/following{/other_user}","gists_url":"https://api.github.com/users/lrlopez/gists{/gist_id}","starred_url":"https://api.github.com/users/lrlopez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lrlopez/subscriptions","organizations_url":"https://api.github.com/users/lrlopez/orgs","repos_url":"https://api.github.com/users/lrlopez/repos","events_url":"https://api.github.com/users/lrlopez/events{/privacy}","received_events_url":"https://api.github.com/users/lrlopez/received_events","type":"User","site_admin":false},"repo":{"id":27345500,"name":"symfony","full_name":"lrlopez/symfony","owner":{"login":"lrlopez","id":547387,"avatar_url":"https://avatars.githubusercontent.com/u/547387?v=3","gravatar_id":"","url":"https://api.github.com/users/lrlopez","html_url":"https://github.com/lrlopez","followers_url":"https://api.github.com/users/lrlopez/followers","following_url":"https://api.github.com/users/lrlopez/following{/other_user}","gists_url":"https://api.github.com/users/lrlopez/gists{/gist_id}","starred_url":"https://api.github.com/users/lrlopez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lrlopez/subscriptions","organizations_url":"https://api.github.com/users/lrlopez/orgs","repos_url":"https://api.github.com/users/lrlopez/repos","events_url":"https://api.github.com/users/lrlopez/events{/privacy}","received_events_url":"https://api.github.com/users/lrlopez/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lrlopez/symfony","description":"The Symfony PHP framework","fork":true,"url":"https://api.github.com/repos/lrlopez/symfony","forks_url":"https://api.github.com/repos/lrlopez/symfony/forks","keys_url":"https://api.github.com/repos/lrlopez/symfony/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lrlopez/symfony/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lrlopez/symfony/teams","hooks_url":"https://api.github.com/repos/lrlopez/symfony/hooks","issue_events_url":"https://api.github.com/repos/lrlopez/symfony/issues/events{/number}","events_url":"https://api.github.com/repos/lrlopez/symfony/events","assignees_url":"https://api.github.com/repos/lrlopez/symfony/assignees{/user}","branches_url":"https://api.github.com/repos/lrlopez/symfony/branches{/branch}","tags_url":"https://api.github.com/repos/lrlopez/symfony/tags","blobs_url":"https://api.github.com/repos/lrlopez/symfony/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lrlopez/symfony/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lrlopez/symfony/git/refs{/sha}","trees_url":"https://api.github.com/repos/lrlopez/symfony/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lrlopez/symfony/statuses/{sha}","languages_url":"https://api.github.com/repos/lrlopez/symfony/languages","stargazers_url":"https://api.github.com/repos/lrlopez/symfony/stargazers","contributors_url":"https://api.github.com/repos/lrlopez/symfony/contributors","subscribers_url":"https://api.github.com/repos/lrlopez/symfony/subscribers","subscription_url":"https://api.github.com/repos/lrlopez/symfony/subscription","commits_url":"https://api.github.com/repos/lrlopez/symfony/commits{/sha}","git_commits_url":"https://api.github.com/repos/lrlopez/symfony/git/commits{/sha}","comments_url":"https://api.github.com/repos/lrlopez/symfony/comments{/number}","issue_comment_url":"https://api.github.com/repos/lrlopez/symfony/issues/comments{/number}","contents_url":"https://api.github.com/repos/lrlopez/symfony/contents/{+path}","compare_url":"https://api.github.com/repos/lrlopez/symfony/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lrlopez/symfony/merges","archive_url":"https://api.github.com/repos/lrlopez/symfony/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lrlopez/symfony/downloads","issues_url":"https://api.github.com/repos/lrlopez/symfony/issues{/number}","pulls_url":"https://api.github.com/repos/lrlopez/symfony/pulls{/number}","milestones_url":"https://api.github.com/repos/lrlopez/symfony/milestones{/number}","notifications_url":"https://api.github.com/repos/lrlopez/symfony/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lrlopez/symfony/labels{/name}","releases_url":"https://api.github.com/repos/lrlopez/symfony/releases{/id}","deployments_url":"https://api.github.com/repos/lrlopez/symfony/deployments","created_at":"2014-11-30T18:25:54Z","updated_at":"2014-11-30T18:26:06Z","pushed_at":"2016-07-04T07:01:13Z","git_url":"git://github.com/lrlopez/symfony.git","ssh_url":"git@github.com:lrlopez/symfony.git","clone_url":"https://github.com/lrlopez/symfony.git","svn_url":"https://github.com/lrlopez/symfony","homepage":"symfony.com","size":73654,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"2.7"}},"base":{"label":"symfony:master","ref":"master","sha":"d9f1a72fff2cd13e230c7df59d9ff4dc34a69605","user":{"login":"symfony","id":143937,"avatar_url":"https://avatars.githubusercontent.com/u/143937?v=3","gravatar_id":"","url":"https://api.github.com/users/symfony","html_url":"https://github.com/symfony","followers_url":"https://api.github.com/users/symfony/followers","following_url":"https://api.github.com/users/symfony/following{/other_user}","gists_url":"https://api.github.com/users/symfony/gists{/gist_id}","starred_url":"https://api.github.com/users/symfony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/symfony/subscriptions","organizations_url":"https://api.github.com/users/symfony/orgs","repos_url":"https://api.github.com/users/symfony/repos","events_url":"https://api.github.com/users/symfony/events{/privacy}","received_events_url":"https://api.github.com/users/symfony/received_events","type":"Organization","site_admin":false},"repo":{"id":458058,"name":"symfony","full_name":"symfony/symfony","owner":{"login":"symfony","id":143937,"avatar_url":"https://avatars.githubusercontent.com/u/143937?v=3","gravatar_id":"","url":"https://api.github.com/users/symfony","html_url":"https://github.com/symfony","followers_url":"https://api.github.com/users/symfony/followers","following_url":"https://api.github.com/users/symfony/following{/other_user}","gists_url":"https://api.github.com/users/symfony/gists{/gist_id}","starred_url":"https://api.github.com/users/symfony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/symfony/subscriptions","organizations_url":"https://api.github.com/users/symfony/orgs","repos_url":"https://api.github.com/users/symfony/repos","events_url":"https://api.github.com/users/symfony/events{/privacy}","received_events_url":"https://api.github.com/users/symfony/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/symfony/symfony","description":"The Symfony PHP framework","fork":false,"url":"https://api.github.com/repos/symfony/symfony","forks_url":"https://api.github.com/repos/symfony/symfony/forks","keys_url":"https://api.github.com/repos/symfony/symfony/keys{/key_id}","collaborators_url":"https://api.github.com/repos/symfony/symfony/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/symfony/symfony/teams","hooks_url":"https://api.github.com/repos/symfony/symfony/hooks","issue_events_url":"https://api.github.com/repos/symfony/symfony/issues/events{/number}","events_url":"https://api.github.com/repos/symfony/symfony/events","assignees_url":"https://api.github.com/repos/symfony/symfony/assignees{/user}","branches_url":"https://api.github.com/repos/symfony/symfony/branches{/branch}","tags_url":"https://api.github.com/repos/symfony/symfony/tags","blobs_url":"https://api.github.com/repos/symfony/symfony/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/symfony/symfony/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/symfony/symfony/git/refs{/sha}","trees_url":"https://api.github.com/repos/symfony/symfony/git/trees{/sha}","statuses_url":"https://api.github.com/repos/symfony/symfony/statuses/{sha}","languages_url":"https://api.github.com/repos/symfony/symfony/languages","stargazers_url":"https://api.github.com/repos/symfony/symfony/stargazers","contributors_url":"https://api.github.com/repos/symfony/symfony/contributors","subscribers_url":"https://api.github.com/repos/symfony/symfony/subscribers","subscription_url":"https://api.github.com/repos/symfony/symfony/subscription","commits_url":"https://api.github.com/repos/symfony/symfony/commits{/sha}","git_commits_url":"https://api.github.com/repos/symfony/symfony/git/commits{/sha}","comments_url":"https://api.github.com/repos/symfony/symfony/comments{/number}","issue_comment_url":"https://api.github.com/repos/symfony/symfony/issues/comments{/number}","contents_url":"https://api.github.com/repos/symfony/symfony/contents/{+path}","compare_url":"https://api.github.com/repos/symfony/symfony/compare/{base}...{head}","merges_url":"https://api.github.com/repos/symfony/symfony/merges","archive_url":"https://api.github.com/repos/symfony/symfony/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/symfony/symfony/downloads","issues_url":"https://api.github.com/repos/symfony/symfony/issues{/number}","pulls_url":"https://api.github.com/repos/symfony/symfony/pulls{/number}","milestones_url":"https://api.github.com/repos/symfony/symfony/milestones{/number}","notifications_url":"https://api.github.com/repos/symfony/symfony/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/symfony/symfony/labels{/name}","releases_url":"https://api.github.com/repos/symfony/symfony/releases{/id}","deployments_url":"https://api.github.com/repos/symfony/symfony/deployments","created_at":"2010-01-04T14:21:21Z","updated_at":"2016-07-21T02:52:34Z","pushed_at":"2016-07-21T07:47:54Z","git_url":"git://github.com/symfony/symfony.git","ssh_url":"git@github.com:symfony/symfony.git","clone_url":"https://github.com/symfony/symfony.git","svn_url":"https://github.com/symfony/symfony","homepage":"symfony.com","size":135144,"stargazers_count":12660,"watchers_count":12660,"language":"PHP","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":4938,"mirror_url":null,"open_issues_count":698,"forks":4938,"open_issues":698,"watchers":12660,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/symfony/symfony/pulls/18016"},"html":{"href":"https://github.com/symfony/symfony/pull/18016"},"issue":{"href":"https://api.github.com/repos/symfony/symfony/issues/18016"},"comments":{"href":"https://api.github.com/repos/symfony/symfony/issues/18016/comments"},"review_comments":{"href":"https://api.github.com/repos/symfony/symfony/pulls/18016/comments"},"review_comment":{"href":"https://api.github.com/repos/symfony/symfony/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/symfony/symfony/pulls/18016/commits"},"statuses":{"href":"https://api.github.com/repos/symfony/symfony/statuses/6b7eeff0953eafcf9e48c67fd1553d68bfc97d6e"}}}}
{"actor":{"display_login":"Ener-Getick"}}