{"action":"created","comment":{"url":"https://api.github.com/repos/ezsystems/repository-forms/pulls/comments/63687057","id":63687057,"diff_hunk":"@@ -0,0 +1,83 @@\n+<?php\n+/**\n+ * This file is part of the eZ RepositoryForms package.\n+ *\n+ * @copyright Copyright (C) eZ Systems AS. All rights reserved.\n+ * @license For full copyright and license information view LICENSE file distributed with this source code.\n+ * @version //autogentag//\n+ */\n+namespace EzSystems\\RepositoryForms\\FieldType\\Mapper;\n+\n+use eZ\\Publish\\API\\Repository\\FieldTypeService;\n+use EzSystems\\RepositoryForms\\Data\\Content\\FieldData;\n+use EzSystems\\RepositoryForms\\FieldType\\DataTransformer\\FieldValueTransformer;\n+use EzSystems\\RepositoryForms\\FieldType\\FieldValueFormMapperInterface;\n+use Symfony\\Component\\Form\\FormInterface;\n+\n+/**\n+ * Generic FieldValueFormMapper that uses a named FormType to generate a FieldValue Form.\n+ * \n+ * The FieldValueTransformer is used as a model transformer.\n+ * \n+ * Example in YAML service definition:\n+ * ```\n+ * ezrepoforms.field_type.form_mapper.ezuser:\n+ *   class: \"%ezrepoforms.field_type.form_mapper.form_type_based.class%\"\n+ *   parent: ezrepoforms.field_type.form_mapper.form_type_based\n+ *   tags:\n+ *     - { name: \"ez.formMapper.fieldValue\", fieldType: \"ezuser\" }\n+ *   calls:\n+ *     - [setFormType, [\"ezuser\"]]\n+ * ```\n+ */\n+final class FormTypeBasedFieldValueFormMapper implements FieldValueFormMapperInterface\n+{\n+    /**\n+     * The FormType used by the mapper. Example: 'text'.\n+     * @var string\n+     */\n+    private $formType;\n+\n+    /**\n+     * @var \\eZ\\Publish\\API\\Repository\\FieldTypeService\n+     */\n+    private $fieldTypeService;\n+\n+    public function __construct(FieldTypeService $fieldTypeService)\n+    {\n+        $this->fieldTypeService = $fieldTypeService;\n+    }\n+\n+    public function setFormType($formType)\n+    {\n+        $this->formType = $formType;\n+    }\n+\n+    /**\n+     * \"Maps\" Field form to current FieldType.","path":"lib/FieldType/Mapper/FormTypeBasedFieldValueFormMapper.php","position":57,"original_position":57,"commit_id":"a780c2da4ea79b0d11a80edf6c5708554effb769","original_commit_id":"a780c2da4ea79b0d11a80edf6c5708554effb769","user":{"login":"glye","id":289744,"avatar_url":"https://avatars.githubusercontent.com/u/289744?v=3","gravatar_id":"","url":"https://api.github.com/users/glye","html_url":"https://github.com/glye","followers_url":"https://api.github.com/users/glye/followers","following_url":"https://api.github.com/users/glye/following{/other_user}","gists_url":"https://api.github.com/users/glye/gists{/gist_id}","starred_url":"https://api.github.com/users/glye/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glye/subscriptions","organizations_url":"https://api.github.com/users/glye/orgs","repos_url":"https://api.github.com/users/glye/repos","events_url":"https://api.github.com/users/glye/events{/privacy}","received_events_url":"https://api.github.com/users/glye/received_events","type":"User","site_admin":false},"body":"Why the quotation marks? (If `map` isn't really the right word here, then it shouldn't be used in the method name either.) I see the interfaces also quote it, looks wrong there too :)","created_at":"2016-05-18T11:34:56Z","updated_at":"2016-05-18T11:34:56Z","html_url":"https://github.com/ezsystems/repository-forms/pull/83#discussion_r63687057","pull_request_url":"https://api.github.com/repos/ezsystems/repository-forms/pulls/83","_links":{"self":{"href":"https://api.github.com/repos/ezsystems/repository-forms/pulls/comments/63687057"},"html":{"href":"https://github.com/ezsystems/repository-forms/pull/83#discussion_r63687057"},"pull_request":{"href":"https://api.github.com/repos/ezsystems/repository-forms/pulls/83"}}},"pull_request":{"url":"https://api.github.com/repos/ezsystems/repository-forms/pulls/83","id":69968533,"html_url":"https://github.com/ezsystems/repository-forms/pull/83","diff_url":"https://github.com/ezsystems/repository-forms/pull/83.diff","patch_url":"https://github.com/ezsystems/repository-forms/pull/83.patch","issue_url":"https://api.github.com/repos/ezsystems/repository-forms/issues/83","number":83,"state":"open","locked":false,"title":"User FieldType content edit support (EZP-27530)","user":{"login":"bdunogier","id":235928,"avatar_url":"https://avatars.githubusercontent.com/u/235928?v=3","gravatar_id":"","url":"https://api.github.com/users/bdunogier","html_url":"https://github.com/bdunogier","followers_url":"https://api.github.com/users/bdunogier/followers","following_url":"https://api.github.com/users/bdunogier/following{/other_user}","gists_url":"https://api.github.com/users/bdunogier/gists{/gist_id}","starred_url":"https://api.github.com/users/bdunogier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bdunogier/subscriptions","organizations_url":"https://api.github.com/users/bdunogier/orgs","repos_url":"https://api.github.com/users/bdunogier/repos","events_url":"https://api.github.com/users/bdunogier/events{/privacy}","received_events_url":"https://api.github.com/users/bdunogier/received_events","type":"User","site_admin":false},"body":"> Implements [EZP-25730](http://jira.ez.no/browse/EZP-25730)\r\n> Status: ready for review\r\n> Topic from feature #85\r\n\r\n### What it does\r\n- adds a User custom FormType\r\n- adds a generic `FormTypeBasedFieldValueFormMapper`. Can be used for any FieldValueMapper that doesn't require specific configuration, and only uses a FormType, native or custom.\r\n- deprecates the service tag `ez.fieldType.formMapper`, and introduces `ez.fieldFormMapper.value` + `ez.fieldFormMapper.definition`\r\n- adds a Value FieldFormMapper for User, using the generic class\r\n- ~~adds [BDD testing](https://github.com/ezsystems/repository-forms/blob/ezp25730-user_account_content_edit_support/features/FieldEdit/edit_user_field.feature) of the user implementation~~ (moved to the feature branch)\r\n- ~~also adds BDD testing for the textline fieldtype, based on scenarii similar to those of user above~~ (moved to the feature branch)\r\n\r\n### What it does not do\r\nSave user data. This requires that we use the UserService instead of the ContentService (like we do in PlatformUI / REST).\r\n\r\n### TODO\r\n- [ ] Create follow-up to actually be able to save a user (User vs Content API)\r\n- [x] Consider extracting the textline fieldtype edit form feature + relevant contexts to a new PR. It can be used for existing types, as well as for newly developed ones. Furthermore, the PR is growing a bit large.\r\n","created_at":"2016-05-13T09:40:10Z","updated_at":"2016-05-18T11:34:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d2743f35c453c03372ce36654f20d370957f0fd4","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ezsystems/repository-forms/pulls/83/commits","review_comments_url":"https://api.github.com/repos/ezsystems/repository-forms/pulls/83/comments","review_comment_url":"https://api.github.com/repos/ezsystems/repository-forms/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ezsystems/repository-forms/issues/83/comments","statuses_url":"https://api.github.com/repos/ezsystems/repository-forms/statuses/a780c2da4ea79b0d11a80edf6c5708554effb769","head":{"label":"ezsystems:ezp25730-user_account_content_edit_support","ref":"ezp25730-user_account_content_edit_support","sha":"a780c2da4ea79b0d11a80edf6c5708554effb769","user":{"login":"ezsystems","id":295311,"avatar_url":"https://avatars.githubusercontent.com/u/295311?v=3","gravatar_id":"","url":"https://api.github.com/users/ezsystems","html_url":"https://github.com/ezsystems","followers_url":"https://api.github.com/users/ezsystems/followers","following_url":"https://api.github.com/users/ezsystems/following{/other_user}","gists_url":"https://api.github.com/users/ezsystems/gists{/gist_id}","starred_url":"https://api.github.com/users/ezsystems/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ezsystems/subscriptions","organizations_url":"https://api.github.com/users/ezsystems/orgs","repos_url":"https://api.github.com/users/ezsystems/repos","events_url":"https://api.github.com/users/ezsystems/events{/privacy}","received_events_url":"https://api.github.com/users/ezsystems/received_events","type":"Organization","site_admin":false},"repo":{"id":34457958,"name":"repository-forms","full_name":"ezsystems/repository-forms","owner":{"login":"ezsystems","id":295311,"avatar_url":"https://avatars.githubusercontent.com/u/295311?v=3","gravatar_id":"","url":"https://api.github.com/users/ezsystems","html_url":"https://github.com/ezsystems","followers_url":"https://api.github.com/users/ezsystems/followers","following_url":"https://api.github.com/users/ezsystems/following{/other_user}","gists_url":"https://api.github.com/users/ezsystems/gists{/gist_id}","starred_url":"https://api.github.com/users/ezsystems/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ezsystems/subscriptions","organizations_url":"https://api.github.com/users/ezsystems/orgs","repos_url":"https://api.github.com/users/ezsystems/repos","events_url":"https://api.github.com/users/ezsystems/events{/privacy}","received_events_url":"https://api.github.com/users/ezsystems/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ezsystems/repository-forms","description":"","fork":false,"url":"https://api.github.com/repos/ezsystems/repository-forms","forks_url":"https://api.github.com/repos/ezsystems/repository-forms/forks","keys_url":"https://api.github.com/repos/ezsystems/repository-forms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ezsystems/repository-forms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ezsystems/repository-forms/teams","hooks_url":"https://api.github.com/repos/ezsystems/repository-forms/hooks","issue_events_url":"https://api.github.com/repos/ezsystems/repository-forms/issues/events{/number}","events_url":"https://api.github.com/repos/ezsystems/repository-forms/events","assignees_url":"https://api.github.com/repos/ezsystems/repository-forms/assignees{/user}","branches_url":"https://api.github.com/repos/ezsystems/repository-forms/branches{/branch}","tags_url":"https://api.github.com/repos/ezsystems/repository-forms/tags","blobs_url":"https://api.github.com/repos/ezsystems/repository-forms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ezsystems/repository-forms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ezsystems/repository-forms/git/refs{/sha}","trees_url":"https://api.github.com/repos/ezsystems/repository-forms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ezsystems/repository-forms/statuses/{sha}","languages_url":"https://api.github.com/repos/ezsystems/repository-forms/languages","stargazers_url":"https://api.github.com/repos/ezsystems/repository-forms/stargazers","contributors_url":"https://api.github.com/repos/ezsystems/repository-forms/contributors","subscribers_url":"https://api.github.com/repos/ezsystems/repository-forms/subscribers","subscription_url":"https://api.github.com/repos/ezsystems/repository-forms/subscription","commits_url":"https://api.github.com/repos/ezsystems/repository-forms/commits{/sha}","git_commits_url":"https://api.github.com/repos/ezsystems/repository-forms/git/commits{/sha}","comments_url":"https://api.github.com/repos/ezsystems/repository-forms/comments{/number}","issue_comment_url":"https://api.github.com/repos/ezsystems/repository-forms/issues/comments{/number}","contents_url":"https://api.github.com/repos/ezsystems/repository-forms/contents/{+path}","compare_url":"https://api.github.com/repos/ezsystems/repository-forms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ezsystems/repository-forms/merges","archive_url":"https://api.github.com/repos/ezsystems/repository-forms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ezsystems/repository-forms/downloads","issues_url":"https://api.github.com/repos/ezsystems/repository-forms/issues{/number}","pulls_url":"https://api.github.com/repos/ezsystems/repository-forms/pulls{/number}","milestones_url":"https://api.github.com/repos/ezsystems/repository-forms/milestones{/number}","notifications_url":"https://api.github.com/repos/ezsystems/repository-forms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ezsystems/repository-forms/labels{/name}","releases_url":"https://api.github.com/repos/ezsystems/repository-forms/releases{/id}","deployments_url":"https://api.github.com/repos/ezsystems/repository-forms/deployments","created_at":"2015-04-23T13:30:07Z","updated_at":"2016-01-11T10:34:02Z","pushed_at":"2016-05-18T11:20:41Z","git_url":"git://github.com/ezsystems/repository-forms.git","ssh_url":"git@github.com:ezsystems/repository-forms.git","clone_url":"https://github.com/ezsystems/repository-forms.git","svn_url":"https://github.com/ezsystems/repository-forms","homepage":null,"size":576,"stargazers_count":2,"watchers_count":2,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":6,"forks":8,"open_issues":6,"watchers":2,"default_branch":"master"}},"base":{"label":"ezsystems:feature-fieldtypes_support-ezp24339","ref":"feature-fieldtypes_support-ezp24339","sha":"cf70338b6b3bb72f7d08e36931df53a158830229","user":{"login":"ezsystems","id":295311,"avatar_url":"https://avatars.githubusercontent.com/u/295311?v=3","gravatar_id":"","url":"https://api.github.com/users/ezsystems","html_url":"https://github.com/ezsystems","followers_url":"https://api.github.com/users/ezsystems/followers","following_url":"https://api.github.com/users/ezsystems/following{/other_user}","gists_url":"https://api.github.com/users/ezsystems/gists{/gist_id}","starred_url":"https://api.github.com/users/ezsystems/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ezsystems/subscriptions","organizations_url":"https://api.github.com/users/ezsystems/orgs","repos_url":"https://api.github.com/users/ezsystems/repos","events_url":"https://api.github.com/users/ezsystems/events{/privacy}","received_events_url":"https://api.github.com/users/ezsystems/received_events","type":"Organization","site_admin":false},"repo":{"id":34457958,"name":"repository-forms","full_name":"ezsystems/repository-forms","owner":{"login":"ezsystems","id":295311,"avatar_url":"https://avatars.githubusercontent.com/u/295311?v=3","gravatar_id":"","url":"https://api.github.com/users/ezsystems","html_url":"https://github.com/ezsystems","followers_url":"https://api.github.com/users/ezsystems/followers","following_url":"https://api.github.com/users/ezsystems/following{/other_user}","gists_url":"https://api.github.com/users/ezsystems/gists{/gist_id}","starred_url":"https://api.github.com/users/ezsystems/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ezsystems/subscriptions","organizations_url":"https://api.github.com/users/ezsystems/orgs","repos_url":"https://api.github.com/users/ezsystems/repos","events_url":"https://api.github.com/users/ezsystems/events{/privacy}","received_events_url":"https://api.github.com/users/ezsystems/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ezsystems/repository-forms","description":"","fork":false,"url":"https://api.github.com/repos/ezsystems/repository-forms","forks_url":"https://api.github.com/repos/ezsystems/repository-forms/forks","keys_url":"https://api.github.com/repos/ezsystems/repository-forms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ezsystems/repository-forms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ezsystems/repository-forms/teams","hooks_url":"https://api.github.com/repos/ezsystems/repository-forms/hooks","issue_events_url":"https://api.github.com/repos/ezsystems/repository-forms/issues/events{/number}","events_url":"https://api.github.com/repos/ezsystems/repository-forms/events","assignees_url":"https://api.github.com/repos/ezsystems/repository-forms/assignees{/user}","branches_url":"https://api.github.com/repos/ezsystems/repository-forms/branches{/branch}","tags_url":"https://api.github.com/repos/ezsystems/repository-forms/tags","blobs_url":"https://api.github.com/repos/ezsystems/repository-forms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ezsystems/repository-forms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ezsystems/repository-forms/git/refs{/sha}","trees_url":"https://api.github.com/repos/ezsystems/repository-forms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ezsystems/repository-forms/statuses/{sha}","languages_url":"https://api.github.com/repos/ezsystems/repository-forms/languages","stargazers_url":"https://api.github.com/repos/ezsystems/repository-forms/stargazers","contributors_url":"https://api.github.com/repos/ezsystems/repository-forms/contributors","subscribers_url":"https://api.github.com/repos/ezsystems/repository-forms/subscribers","subscription_url":"https://api.github.com/repos/ezsystems/repository-forms/subscription","commits_url":"https://api.github.com/repos/ezsystems/repository-forms/commits{/sha}","git_commits_url":"https://api.github.com/repos/ezsystems/repository-forms/git/commits{/sha}","comments_url":"https://api.github.com/repos/ezsystems/repository-forms/comments{/number}","issue_comment_url":"https://api.github.com/repos/ezsystems/repository-forms/issues/comments{/number}","contents_url":"https://api.github.com/repos/ezsystems/repository-forms/contents/{+path}","compare_url":"https://api.github.com/repos/ezsystems/repository-forms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ezsystems/repository-forms/merges","archive_url":"https://api.github.com/repos/ezsystems/repository-forms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ezsystems/repository-forms/downloads","issues_url":"https://api.github.com/repos/ezsystems/repository-forms/issues{/number}","pulls_url":"https://api.github.com/repos/ezsystems/repository-forms/pulls{/number}","milestones_url":"https://api.github.com/repos/ezsystems/repository-forms/milestones{/number}","notifications_url":"https://api.github.com/repos/ezsystems/repository-forms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ezsystems/repository-forms/labels{/name}","releases_url":"https://api.github.com/repos/ezsystems/repository-forms/releases{/id}","deployments_url":"https://api.github.com/repos/ezsystems/repository-forms/deployments","created_at":"2015-04-23T13:30:07Z","updated_at":"2016-01-11T10:34:02Z","pushed_at":"2016-05-18T11:20:41Z","git_url":"git://github.com/ezsystems/repository-forms.git","ssh_url":"git@github.com:ezsystems/repository-forms.git","clone_url":"https://github.com/ezsystems/repository-forms.git","svn_url":"https://github.com/ezsystems/repository-forms","homepage":null,"size":576,"stargazers_count":2,"watchers_count":2,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":6,"forks":8,"open_issues":6,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ezsystems/repository-forms/pulls/83"},"html":{"href":"https://github.com/ezsystems/repository-forms/pull/83"},"issue":{"href":"https://api.github.com/repos/ezsystems/repository-forms/issues/83"},"comments":{"href":"https://api.github.com/repos/ezsystems/repository-forms/issues/83/comments"},"review_comments":{"href":"https://api.github.com/repos/ezsystems/repository-forms/pulls/83/comments"},"review_comment":{"href":"https://api.github.com/repos/ezsystems/repository-forms/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ezsystems/repository-forms/pulls/83/commits"},"statuses":{"href":"https://api.github.com/repos/ezsystems/repository-forms/statuses/a780c2da4ea79b0d11a80edf6c5708554effb769"}}}}