{"action":"created","comment":{"url":"https://api.github.com/repos/symfony/symfony/pulls/comments/48597788","id":48597788,"diff_hunk":"@@ -28,7 +28,7 @@ class ClassMetadata implements ClassMetadataInterface\n     public $name;\n \n     /**\n-     * @var AttributeMetadataInterface[]\n+     * @var array","path":"src/Symfony/Component/Serializer/Mapping/ClassMetadata.php","position":5,"original_position":5,"commit_id":"98ff26acaa3039449800986ad28266198b6f45bb","original_commit_id":"98ff26acaa3039449800986ad28266198b6f45bb","user":{"login":"xabbuh","id":1957048,"avatar_url":"https://avatars.githubusercontent.com/u/1957048?v=3","gravatar_id":"","url":"https://api.github.com/users/xabbuh","html_url":"https://github.com/xabbuh","followers_url":"https://api.github.com/users/xabbuh/followers","following_url":"https://api.github.com/users/xabbuh/following{/other_user}","gists_url":"https://api.github.com/users/xabbuh/gists{/gist_id}","starred_url":"https://api.github.com/users/xabbuh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xabbuh/subscriptions","organizations_url":"https://api.github.com/users/xabbuh/orgs","repos_url":"https://api.github.com/users/xabbuh/repos","events_url":"https://api.github.com/users/xabbuh/events{/privacy}","received_events_url":"https://api.github.com/users/xabbuh/received_events","type":"User","site_admin":false},"body":"Why this change?","created_at":"2015-12-30T10:49:49Z","updated_at":"2015-12-30T10:49:49Z","html_url":"https://github.com/symfony/symfony/pull/17113#discussion_r48597788","pull_request_url":"https://api.github.com/repos/symfony/symfony/pulls/17113","_links":{"self":{"href":"https://api.github.com/repos/symfony/symfony/pulls/comments/48597788"},"html":{"href":"https://github.com/symfony/symfony/pull/17113#discussion_r48597788"},"pull_request":{"href":"https://api.github.com/repos/symfony/symfony/pulls/17113"}}},"pull_request":{"url":"https://api.github.com/repos/symfony/symfony/pulls/17113","id":54402451,"html_url":"https://github.com/symfony/symfony/pull/17113","diff_url":"https://github.com/symfony/symfony/pull/17113.diff","patch_url":"https://github.com/symfony/symfony/pull/17113.patch","issue_url":"https://api.github.com/repos/symfony/symfony/issues/17113","number":17113,"state":"open","locked":false,"title":"[Serializer] Add a MaxDepth option","user":{"login":"dunglas","id":57224,"avatar_url":"https://avatars.githubusercontent.com/u/57224?v=3","gravatar_id":"","url":"https://api.github.com/users/dunglas","html_url":"https://github.com/dunglas","followers_url":"https://api.github.com/users/dunglas/followers","following_url":"https://api.github.com/users/dunglas/following{/other_user}","gists_url":"https://api.github.com/users/dunglas/gists{/gist_id}","starred_url":"https://api.github.com/users/dunglas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dunglas/subscriptions","organizations_url":"https://api.github.com/users/dunglas/orgs","repos_url":"https://api.github.com/users/dunglas/repos","events_url":"https://api.github.com/users/dunglas/events{/privacy}","received_events_url":"https://api.github.com/users/dunglas/received_events","type":"User","site_admin":false},"body":"| Q             | A\r\n| ------------- | ---\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 | https://github.com/symfony/symfony/issues/14924#issuecomment-111977173, https://github.com/dunglas/DunglasApiBundle/issues/104#issuecomment-110644569\r\n| License       | MIT\r\n| Doc PR        | todo\r\n\r\nAdd a max depth option during the normalization process. Especially useful when normalizing trees.\r\n\r\nUsage:\r\n\r\n```php\r\nuse Symfony\\Component\\Serializer\\Annotation\\MaxDepth;\r\n\r\nclass MyObj\r\n{\r\n    /**\r\n     * @MaxDepth(2)\r\n     */\r\n    public $foo;\r\n\r\n    /**\r\n     * @var self\r\n     */\r\n    public $child;\r\n}\r\n\r\nuse Doctrine\\Common\\Annotations\\AnnotationReader;\r\nuse Symfony\\Component\\Serializer\\Normalizer\\ObjectNormalizer;\r\nuse Symfony\\Component\\Serializer\\Serializer;\r\nuse Symfony\\Component\\Serializer\\Mapping\\Loader\\AnnotationLoader;\r\nuse Symfony\\Component\\Serializer\\Mapping\\Factory\\ClassMetadataFactory;\r\n\r\n$classMetadataFactory = new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader()));\r\n$normalizer = new ObjectNormalizer($classMetadataFactory);\r\n$serializer = new Serializer(array($this->normalizer));\r\n\r\n$level1 = new MyObj();\r\n$level1->foo = 'level1';\r\n\r\n$level2 = new MyObj();\r\n$level2->foo = 'level2';\r\n$level1->child = $level2;\r\n\r\n$level3 = new MyObj();\r\n$level3->foo = 'level3';\r\n$level2->child = $level3;\r\n$result = $serializer->normalize($level1, null, array(ObjectNormalizer::ENABLE_MAX_DEPTH => true));\r\n/*      $result = array(\r\n            'foo' => 'level1',\r\n            'child' => array(\r\n                    'foo' => 'level2',\r\n                    'child' => array(\r\n                            'child' => null,\r\n                        ),\r\n                ),\r\n        );\r\n*/\r\n```\r\n\r\n* [x] Metadata support\r\n* [x] `@MaxDepth(2)` annotation and loader\r\n* [x] XML loader\r\n* [x] YAML loader\r\n* [x] Delegate recursive normalization at the end of the process\r\n* [x] Use constants with Late Static Binding in the abstract class instead of raw strings\r\n* [x] Move common logic to the abstract class\r\n\r\n/cc @mRoca @csarrazi ","created_at":"2015-12-22T18:54:52Z","updated_at":"2015-12-30T10:49:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"940e0dcb5760d33b16598bfe45d48f9ebda57e2d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/symfony/symfony/pulls/17113/commits","review_comments_url":"https://api.github.com/repos/symfony/symfony/pulls/17113/comments","review_comment_url":"https://api.github.com/repos/symfony/symfony/pulls/comments{/number}","comments_url":"https://api.github.com/repos/symfony/symfony/issues/17113/comments","statuses_url":"https://api.github.com/repos/symfony/symfony/statuses/98ff26acaa3039449800986ad28266198b6f45bb","head":{"label":"dunglas:max_depth","ref":"max_depth","sha":"98ff26acaa3039449800986ad28266198b6f45bb","user":{"login":"dunglas","id":57224,"avatar_url":"https://avatars.githubusercontent.com/u/57224?v=3","gravatar_id":"","url":"https://api.github.com/users/dunglas","html_url":"https://github.com/dunglas","followers_url":"https://api.github.com/users/dunglas/followers","following_url":"https://api.github.com/users/dunglas/following{/other_user}","gists_url":"https://api.github.com/users/dunglas/gists{/gist_id}","starred_url":"https://api.github.com/users/dunglas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dunglas/subscriptions","organizations_url":"https://api.github.com/users/dunglas/orgs","repos_url":"https://api.github.com/users/dunglas/repos","events_url":"https://api.github.com/users/dunglas/events{/privacy}","received_events_url":"https://api.github.com/users/dunglas/received_events","type":"User","site_admin":false},"repo":{"id":1124839,"name":"symfony","full_name":"dunglas/symfony","owner":{"login":"dunglas","id":57224,"avatar_url":"https://avatars.githubusercontent.com/u/57224?v=3","gravatar_id":"","url":"https://api.github.com/users/dunglas","html_url":"https://github.com/dunglas","followers_url":"https://api.github.com/users/dunglas/followers","following_url":"https://api.github.com/users/dunglas/following{/other_user}","gists_url":"https://api.github.com/users/dunglas/gists{/gist_id}","starred_url":"https://api.github.com/users/dunglas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dunglas/subscriptions","organizations_url":"https://api.github.com/users/dunglas/orgs","repos_url":"https://api.github.com/users/dunglas/repos","events_url":"https://api.github.com/users/dunglas/events{/privacy}","received_events_url":"https://api.github.com/users/dunglas/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dunglas/symfony","description":"The Symfony2 PHP framework (PHP 5.3 only -- not yet stable) -- documentation for master is at http://docs.symfony-reloaded.org/master/","fork":true,"url":"https://api.github.com/repos/dunglas/symfony","forks_url":"https://api.github.com/repos/dunglas/symfony/forks","keys_url":"https://api.github.com/repos/dunglas/symfony/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dunglas/symfony/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dunglas/symfony/teams","hooks_url":"https://api.github.com/repos/dunglas/symfony/hooks","issue_events_url":"https://api.github.com/repos/dunglas/symfony/issues/events{/number}","events_url":"https://api.github.com/repos/dunglas/symfony/events","assignees_url":"https://api.github.com/repos/dunglas/symfony/assignees{/user}","branches_url":"https://api.github.com/repos/dunglas/symfony/branches{/branch}","tags_url":"https://api.github.com/repos/dunglas/symfony/tags","blobs_url":"https://api.github.com/repos/dunglas/symfony/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dunglas/symfony/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dunglas/symfony/git/refs{/sha}","trees_url":"https://api.github.com/repos/dunglas/symfony/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dunglas/symfony/statuses/{sha}","languages_url":"https://api.github.com/repos/dunglas/symfony/languages","stargazers_url":"https://api.github.com/repos/dunglas/symfony/stargazers","contributors_url":"https://api.github.com/repos/dunglas/symfony/contributors","subscribers_url":"https://api.github.com/repos/dunglas/symfony/subscribers","subscription_url":"https://api.github.com/repos/dunglas/symfony/subscription","commits_url":"https://api.github.com/repos/dunglas/symfony/commits{/sha}","git_commits_url":"https://api.github.com/repos/dunglas/symfony/git/commits{/sha}","comments_url":"https://api.github.com/repos/dunglas/symfony/comments{/number}","issue_comment_url":"https://api.github.com/repos/dunglas/symfony/issues/comments{/number}","contents_url":"https://api.github.com/repos/dunglas/symfony/contents/{+path}","compare_url":"https://api.github.com/repos/dunglas/symfony/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dunglas/symfony/merges","archive_url":"https://api.github.com/repos/dunglas/symfony/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dunglas/symfony/downloads","issues_url":"https://api.github.com/repos/dunglas/symfony/issues{/number}","pulls_url":"https://api.github.com/repos/dunglas/symfony/pulls{/number}","milestones_url":"https://api.github.com/repos/dunglas/symfony/milestones{/number}","notifications_url":"https://api.github.com/repos/dunglas/symfony/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dunglas/symfony/labels{/name}","releases_url":"https://api.github.com/repos/dunglas/symfony/releases{/id}","created_at":"2010-11-30T08:18:04Z","updated_at":"2014-06-03T21:19:58Z","pushed_at":"2015-12-28T10:57:53Z","git_url":"git://github.com/dunglas/symfony.git","ssh_url":"git@github.com:dunglas/symfony.git","clone_url":"https://github.com/dunglas/symfony.git","svn_url":"https://github.com/dunglas/symfony","homepage":"http://www.symfony-project.org/","size":64306,"stargazers_count":1,"watchers_count":1,"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":1,"default_branch":"master"}},"base":{"label":"symfony:master","ref":"master","sha":"e93ef5d2b8649802ee573659b8240c2b7a915a79","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}","created_at":"2010-01-04T14:21:21Z","updated_at":"2015-12-30T10:09:48Z","pushed_at":"2015-12-30T10:42:07Z","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":97698,"stargazers_count":11398,"watchers_count":11398,"language":"PHP","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":4500,"mirror_url":null,"open_issues_count":899,"forks":4500,"open_issues":899,"watchers":11398,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/symfony/symfony/pulls/17113"},"html":{"href":"https://github.com/symfony/symfony/pull/17113"},"issue":{"href":"https://api.github.com/repos/symfony/symfony/issues/17113"},"comments":{"href":"https://api.github.com/repos/symfony/symfony/issues/17113/comments"},"review_comments":{"href":"https://api.github.com/repos/symfony/symfony/pulls/17113/comments"},"review_comment":{"href":"https://api.github.com/repos/symfony/symfony/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/symfony/symfony/pulls/17113/commits"},"statuses":{"href":"https://api.github.com/repos/symfony/symfony/statuses/98ff26acaa3039449800986ad28266198b6f45bb"}}}}