{"action":"created","comment":{"url":"https://api.github.com/repos/symfony/symfony/pulls/comments/56289802","id":56289802,"diff_hunk":"@@ -0,0 +1,69 @@\n+<?php\n+\n+/*\n+ * This file is part of the Symfony package.\n+ *\n+ * (c) Fabien Potencier <fabien@symfony.com>\n+ *\n+ * For the full copyright and license information, please view the LICENSE\n+ * file that was distributed with this source code.\n+ */\n+\n+namespace Symfony\\Component\\Serializer\\NameConverter;\n+\n+/**\n+ * ChainNameConverter allows to process a property name with multiple converters.\n+ *\n+ * @author Jérôme Gamez <jerome@gamez.name>\n+ */\n+class ChainNameConverter implements NameConverterInterface\n+{\n+    /**\n+     * @var NameConverterInterface[]\n+     */\n+    protected $converters = array();\n+\n+    /**\n+     * @param array $converters A list of name converters that will be used to convert a given property name.\n+     */\n+    public function __construct(array $converters = array())\n+    {\n+        foreach ($converters as $converter) {\n+            $this->addConverter($converter);\n+        }","path":"src/Symfony/Component/Serializer/NameConverter/ChainNameConverter.php","position":33,"original_position":33,"commit_id":"c8b64353d16c47de361c0eceddb594b9c52af8a5","original_commit_id":"c8b64353d16c47de361c0eceddb594b9c52af8a5","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":"just use `$this->converters = $converters`","created_at":"2016-03-16T07:12:34Z","updated_at":"2016-03-16T07:12:34Z","html_url":"https://github.com/symfony/symfony/pull/18182#discussion_r56289802","pull_request_url":"https://api.github.com/repos/symfony/symfony/pulls/18182","_links":{"self":{"href":"https://api.github.com/repos/symfony/symfony/pulls/comments/56289802"},"html":{"href":"https://github.com/symfony/symfony/pull/18182#discussion_r56289802"},"pull_request":{"href":"https://api.github.com/repos/symfony/symfony/pulls/18182"}}},"pull_request":{"url":"https://api.github.com/repos/symfony/symfony/pulls/18182","id":62964362,"html_url":"https://github.com/symfony/symfony/pull/18182","diff_url":"https://github.com/symfony/symfony/pull/18182.diff","patch_url":"https://github.com/symfony/symfony/pull/18182.patch","issue_url":"https://api.github.com/repos/symfony/symfony/issues/18182","number":18182,"state":"open","locked":false,"title":"[Serializer] Add ChainNameConverter","user":{"login":"jeromegamez","id":67554,"avatar_url":"https://avatars.githubusercontent.com/u/67554?v=3","gravatar_id":"","url":"https://api.github.com/users/jeromegamez","html_url":"https://github.com/jeromegamez","followers_url":"https://api.github.com/users/jeromegamez/followers","following_url":"https://api.github.com/users/jeromegamez/following{/other_user}","gists_url":"https://api.github.com/users/jeromegamez/gists{/gist_id}","starred_url":"https://api.github.com/users/jeromegamez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeromegamez/subscriptions","organizations_url":"https://api.github.com/users/jeromegamez/orgs","repos_url":"https://api.github.com/users/jeromegamez/repos","events_url":"https://api.github.com/users/jeromegamez/events{/privacy}","received_events_url":"https://api.github.com/users/jeromegamez/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 | \r\n| License       | MIT\r\n| Doc PR        | symfony/symfony-docs/pull/6374\r\n\r\nThe `ChainNameConverter` allows to process property names with multiple converters. This can be useful e.g. when you have to CamelCase underscored property names, and then need to rename them by custom rules.\r\n\r\nMy current use case is that I receive serialized data with (some, but not all) german snake cased property names (it's a 3rd party API :smile:) which I need to camelcase *and* translate to english, so that e.g. a property named `ist_archiviert` would first be converted to `istArchiviert` and then translated into `isArchived` by a second converter. Properties that are already in english language would just be camelcased, and already valid property names would remain unchanged.\r\n\r\nAn usage example (with the `OrgPrefixNameConverter` from the docs):\r\n\r\n```php\r\nuse Symfony\\Component\\Serializer\\NameConverter\\CamelCaseToSnakeCaseNameConverter;\r\nuse Symfony\\Component\\Serializer\\NameConverter\\ChainNameConverter;\r\n\r\n$camelCaseNameConverter = new CamelCaseToSnakeCaseNameConverter();\r\n$orgPrefixNameConverter = new OrgPrefixNameConverter();\r\n\r\n$nameConverter = new ChainNameConverter(array($camelCaseNameConverter, $orgPrefixNameConverter));\r\n$normalizer = new ObjectNormalizer(null, $nameConverter);\r\n\r\n:octocat: ","created_at":"2016-03-15T19:36:09Z","updated_at":"2016-03-16T07:12:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"471d353d225d3421340519c3bfcc4d7bc92aa202","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/symfony/symfony/pulls/18182/commits","review_comments_url":"https://api.github.com/repos/symfony/symfony/pulls/18182/comments","review_comment_url":"https://api.github.com/repos/symfony/symfony/pulls/comments{/number}","comments_url":"https://api.github.com/repos/symfony/symfony/issues/18182/comments","statuses_url":"https://api.github.com/repos/symfony/symfony/statuses/c8b64353d16c47de361c0eceddb594b9c52af8a5","head":{"label":"jeromegamez:chain-name-converter","ref":"chain-name-converter","sha":"c8b64353d16c47de361c0eceddb594b9c52af8a5","user":{"login":"jeromegamez","id":67554,"avatar_url":"https://avatars.githubusercontent.com/u/67554?v=3","gravatar_id":"","url":"https://api.github.com/users/jeromegamez","html_url":"https://github.com/jeromegamez","followers_url":"https://api.github.com/users/jeromegamez/followers","following_url":"https://api.github.com/users/jeromegamez/following{/other_user}","gists_url":"https://api.github.com/users/jeromegamez/gists{/gist_id}","starred_url":"https://api.github.com/users/jeromegamez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeromegamez/subscriptions","organizations_url":"https://api.github.com/users/jeromegamez/orgs","repos_url":"https://api.github.com/users/jeromegamez/repos","events_url":"https://api.github.com/users/jeromegamez/events{/privacy}","received_events_url":"https://api.github.com/users/jeromegamez/received_events","type":"User","site_admin":false},"repo":{"id":53969047,"name":"symfony","full_name":"jeromegamez/symfony","owner":{"login":"jeromegamez","id":67554,"avatar_url":"https://avatars.githubusercontent.com/u/67554?v=3","gravatar_id":"","url":"https://api.github.com/users/jeromegamez","html_url":"https://github.com/jeromegamez","followers_url":"https://api.github.com/users/jeromegamez/followers","following_url":"https://api.github.com/users/jeromegamez/following{/other_user}","gists_url":"https://api.github.com/users/jeromegamez/gists{/gist_id}","starred_url":"https://api.github.com/users/jeromegamez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeromegamez/subscriptions","organizations_url":"https://api.github.com/users/jeromegamez/orgs","repos_url":"https://api.github.com/users/jeromegamez/repos","events_url":"https://api.github.com/users/jeromegamez/events{/privacy}","received_events_url":"https://api.github.com/users/jeromegamez/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jeromegamez/symfony","description":"The Symfony PHP framework","fork":true,"url":"https://api.github.com/repos/jeromegamez/symfony","forks_url":"https://api.github.com/repos/jeromegamez/symfony/forks","keys_url":"https://api.github.com/repos/jeromegamez/symfony/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jeromegamez/symfony/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jeromegamez/symfony/teams","hooks_url":"https://api.github.com/repos/jeromegamez/symfony/hooks","issue_events_url":"https://api.github.com/repos/jeromegamez/symfony/issues/events{/number}","events_url":"https://api.github.com/repos/jeromegamez/symfony/events","assignees_url":"https://api.github.com/repos/jeromegamez/symfony/assignees{/user}","branches_url":"https://api.github.com/repos/jeromegamez/symfony/branches{/branch}","tags_url":"https://api.github.com/repos/jeromegamez/symfony/tags","blobs_url":"https://api.github.com/repos/jeromegamez/symfony/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jeromegamez/symfony/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jeromegamez/symfony/git/refs{/sha}","trees_url":"https://api.github.com/repos/jeromegamez/symfony/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jeromegamez/symfony/statuses/{sha}","languages_url":"https://api.github.com/repos/jeromegamez/symfony/languages","stargazers_url":"https://api.github.com/repos/jeromegamez/symfony/stargazers","contributors_url":"https://api.github.com/repos/jeromegamez/symfony/contributors","subscribers_url":"https://api.github.com/repos/jeromegamez/symfony/subscribers","subscription_url":"https://api.github.com/repos/jeromegamez/symfony/subscription","commits_url":"https://api.github.com/repos/jeromegamez/symfony/commits{/sha}","git_commits_url":"https://api.github.com/repos/jeromegamez/symfony/git/commits{/sha}","comments_url":"https://api.github.com/repos/jeromegamez/symfony/comments{/number}","issue_comment_url":"https://api.github.com/repos/jeromegamez/symfony/issues/comments{/number}","contents_url":"https://api.github.com/repos/jeromegamez/symfony/contents/{+path}","compare_url":"https://api.github.com/repos/jeromegamez/symfony/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jeromegamez/symfony/merges","archive_url":"https://api.github.com/repos/jeromegamez/symfony/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jeromegamez/symfony/downloads","issues_url":"https://api.github.com/repos/jeromegamez/symfony/issues{/number}","pulls_url":"https://api.github.com/repos/jeromegamez/symfony/pulls{/number}","milestones_url":"https://api.github.com/repos/jeromegamez/symfony/milestones{/number}","notifications_url":"https://api.github.com/repos/jeromegamez/symfony/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jeromegamez/symfony/labels{/name}","releases_url":"https://api.github.com/repos/jeromegamez/symfony/releases{/id}","deployments_url":"https://api.github.com/repos/jeromegamez/symfony/deployments","created_at":"2016-03-15T18:32:16Z","updated_at":"2016-03-15T18:32:31Z","pushed_at":"2016-03-15T19:19:02Z","git_url":"git://github.com/jeromegamez/symfony.git","ssh_url":"git@github.com:jeromegamez/symfony.git","clone_url":"https://github.com/jeromegamez/symfony.git","svn_url":"https://github.com/jeromegamez/symfony","homepage":"symfony.com","size":69086,"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":"master"}},"base":{"label":"symfony:master","ref":"master","sha":"f29d46f29b91ea5c30699cf6bdb8e65545d1dd26","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-03-15T21:49:01Z","pushed_at":"2016-03-16T03:42:42Z","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":103768,"stargazers_count":11929,"watchers_count":11929,"language":"PHP","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":4700,"mirror_url":null,"open_issues_count":699,"forks":4700,"open_issues":699,"watchers":11929,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/symfony/symfony/pulls/18182"},"html":{"href":"https://github.com/symfony/symfony/pull/18182"},"issue":{"href":"https://api.github.com/repos/symfony/symfony/issues/18182"},"comments":{"href":"https://api.github.com/repos/symfony/symfony/issues/18182/comments"},"review_comments":{"href":"https://api.github.com/repos/symfony/symfony/pulls/18182/comments"},"review_comment":{"href":"https://api.github.com/repos/symfony/symfony/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/symfony/symfony/pulls/18182/commits"},"statuses":{"href":"https://api.github.com/repos/symfony/symfony/statuses/c8b64353d16c47de361c0eceddb594b9c52af8a5"}}}}