{"action":"created","issue":{"url":"https://api.github.com/repos/ezsystems/repository-forms/issues/83","repository_url":"https://api.github.com/repos/ezsystems/repository-forms","labels_url":"https://api.github.com/repos/ezsystems/repository-forms/issues/83/labels{/name}","comments_url":"https://api.github.com/repos/ezsystems/repository-forms/issues/83/comments","events_url":"https://api.github.com/repos/ezsystems/repository-forms/issues/83/events","html_url":"https://github.com/ezsystems/repository-forms/pull/83","id":154672509,"number":83,"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},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-05-13T09:40:10Z","updated_at":"2016-05-13T12:57:42Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ezsystems/repository-forms/pulls/83","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"},"body":"> Implements [EZP-27530](http://jira.ez.no/browse/EZP-27530)\r\n> Status: ready for review\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\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### Testing\r\n[BDD coverage] of the user fieldtype. Comments welcome.\r\n\r\n### TODO\r\n- [ ] Create follow-up to actually be able to save a user (User vs Content API)\r\n"},"comment":{"url":"https://api.github.com/repos/ezsystems/repository-forms/issues/comments/219035287","html_url":"https://github.com/ezsystems/repository-forms/pull/83#issuecomment-219035287","issue_url":"https://api.github.com/repos/ezsystems/repository-forms/issues/83","id":219035287,"user":{"login":"ezrobot","id":681611,"avatar_url":"https://avatars.githubusercontent.com/u/681611?v=3","gravatar_id":"","url":"https://api.github.com/users/ezrobot","html_url":"https://github.com/ezrobot","followers_url":"https://api.github.com/users/ezrobot/followers","following_url":"https://api.github.com/users/ezrobot/following{/other_user}","gists_url":"https://api.github.com/users/ezrobot/gists{/gist_id}","starred_url":"https://api.github.com/users/ezrobot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ezrobot/subscriptions","organizations_url":"https://api.github.com/users/ezrobot/orgs","repos_url":"https://api.github.com/users/ezrobot/repos","events_url":"https://api.github.com/users/ezrobot/events{/privacy}","received_events_url":"https://api.github.com/users/ezrobot/received_events","type":"User","site_admin":false},"created_at":"2016-05-13T12:57:42Z","updated_at":"2016-05-13T12:57:42Z","body":"This Pull Request does not respect [PSR-2 Coding Standards](http://www.php-fig.org/psr/psr-2/), please, see the suggested diff below:\n\n```diff\nLoaded config from \"/jenkins/jenkins.std/jobs/RepositoryForms-Pull-Request-checker/workspace/.php_cs\"\n.F..\nLegend: ?-unknown, I-invalid file syntax, file ignored, .-no changes, F-fixed, E-error\n   1) lib/FieldType/Mapper/FormTypeBasedFieldValueFormMapper.php (phpdoc_short_description)\n      ---------- begin diff ----------\n      --- Original\n      +++ New\n      @@ @@\n           /**\n      -     * The FormType used by the mapper. Example: 'text'\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.\n            * Allows to add form fields for content edition.\n            *\n            * @param FormInterface $fieldForm Form for the current Field.\n            * @param FieldData $data Underlying data for current Field form.\n            */\n           public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data)\n           {\n               $fieldDefinition = $data->fieldDefinition;\n               $formConfig = $fieldForm->getConfig();\n               $label = $fieldDefinition->getName($formConfig->getOption('languageCode')) ?: reset($fieldDefinition->getNames());\n       \n               $fieldForm\n                   ->add(\n                       $formConfig->getFormFactory()->createBuilder()\n                           ->create(\n                               'value',\n                               $this->formType,\n                               ['required' => $fieldDefinition->isRequired, 'label' => $label]\n                           )\n                           ->addModelTransformer(new FieldValueTransformer($this->fieldTypeService->getFieldType($fieldDefinition->fieldTypeIdentifier)))\n                           // Deactivate auto-initialize as we're not on the root form.\n                           ->setAutoInitialize(false)\n                           ->getForm()\n                   );\n           }\n       }\n       \n      \n      ---------- end diff ----------\n\nFixed all files in 2.490 seconds, 6.750 MB memory used\n```\n"}}