{"action":"created","issue":{"url":"https://api.github.com/repos/symfony/symfony/issues/18016","repository_url":"https://api.github.com/repos/symfony/symfony","labels_url":"https://api.github.com/repos/symfony/symfony/issues/18016/labels{/name}","comments_url":"https://api.github.com/repos/symfony/symfony/issues/18016/comments","events_url":"https://api.github.com/repos/symfony/symfony/issues/18016/events","html_url":"https://github.com/symfony/symfony/pull/18016","id":138626568,"number":18016,"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},"labels":[{"url":"https://api.github.com/repos/symfony/symfony/labels/Feature","name":"Feature","color":"02e10c"},{"url":"https://api.github.com/repos/symfony/symfony/labels/PropertyAccess","name":"PropertyAccess","color":"DDDDDD"},{"url":"https://api.github.com/repos/symfony/symfony/labels/Status:%20Needs%20Review","name":"Status: Needs Review","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":15,"created_at":"2016-03-05T00:43:42Z","updated_at":"2016-04-01T17:06:07Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/symfony/symfony/pulls/18016","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"},"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 * @Getter(property=\"calculated\")\r\n */\r\npublic function getCalculated()\r\n{\r\n    // whatever...\r\n}\r\n\r\n/**\r\n * @Setter(property=\"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"},"comment":{"url":"https://api.github.com/repos/symfony/symfony/issues/comments/204473147","html_url":"https://github.com/symfony/symfony/pull/18016#issuecomment-204473147","issue_url":"https://api.github.com/repos/symfony/symfony/issues/18016","id":204473147,"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},"created_at":"2016-04-01T17:06:07Z","updated_at":"2016-04-01T17:06:07Z","body":"@webmozart, thanks for the review"}}