Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EZP-27646: Implement editing support for User FieldType #145

Merged
merged 6 commits into from
Dec 7, 2017

Conversation

webhdx
Copy link
Contributor

@webhdx webhdx commented Aug 25, 2017

JIRA: https://jira.ez.no/browse/EZP-27646
JIRA (epic): https://jira.ez.no/browse/EZP-26700

Description

This PR provides basic editing support for:

Remarks

I had to implement completely different infrastructure for editing Users due to how kernel manages users. My implementation introduces separate action dispatcher with new event names, separated form processors, types, data classes etc.

TODO

  • document BC breaks
  • check Behat tests
  • check unit tests

Copy link
Member

@bdunogier bdunogier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow, that's a large pull-request :)

I'm not gonna dig into a detailed code review, it's not my role anyway 👼 The PR looks really good and clean. But I'll focus on the extensibility of that, meaning customizing the forms when integrating user interaction.

I need to explain what the initial plan, and its benefits, were. I understand that you have built from what was there, and it makes sense as well. Just know that it wasn't the final version of it. Maybe these information can help make some things more consistent.

The way this was done, that you have built from, is that View objects are returned by the various actions (except for UserRegister, btw ?) for the various user actions. The user templates configuration is a custom one, where each can be configured per scope, that is injected using a ViewTemplateListener.

The real plan was to add a ViewBuilder (similar to ContentViewBuilder), that builds the View object based on the Request and the user View configuration (also not implemented). Then the views are rendered by the ViewRenderer (used in your version as well). The main benefits were customizable controllers, as well as conditional overriding of templates (per user content type, for instance).

It would require:

  • that the actual action,the code you currently have in the controllers, is moved to the builder. The controller actions themselves will be empty, since they can be overridden.
  • that view configuration (as in content_view) is added
  • that we have support for matchers that apply to these views

Let me know if you have questions about the above.

*
* @return UserCreateView|Response
*
* @throws InvalidArgumentType
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ain't that a lot of exceptions for such a little method ? :)
I'm wondering if we shouldn't catch and group most of these into exceptions that make sense from the standpoint of a controller.

ezrepoforms.form_processor.content_type.class: EzSystems\RepositoryForms\Form\Processor\ContentTypeFormProcessor
ezrepoforms.form_processor.content_type.options.redirect_route_after_publish: ~
ezrepoforms.form_processor.content_type.options:
redirectRouteAfterPublish: "%ezrepoforms.form_processor.content_type.options.redirect_route_after_publish%"
ezrepoforms.form_processor.content_type_group.class: EzSystems\RepositoryForms\Form\Processor\ContentTypeGroupFormProcessor
ezrepoforms.form_processor.content.class: EzSystems\RepositoryForms\Form\Processor\ContentFormProcessor
ezrepoforms.form_processor.user_register.class: EzSystems\RepositoryForms\Form\Processor\UserRegisterFormProcessor
ezrepoforms.form_processor.user_create.class: EzSystems\RepositoryForms\Form\Processor\User\UserCreateFormProcessor
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One remark about the services definitions: what about adding a new file for the user stuff, that uses the newer conventions (no %% placeholders for classes names, for instance) ? At least we wouldn't have to change those later on.

It would also help keep the files reasonable in size, and that can't hurt :)

@webhdx
Copy link
Contributor Author

webhdx commented Nov 29, 2017

Hey @bdunogier. I really like "the master plan" and will happily work on this further more. With current setup there is still a lot of flexibility as developers are able to inject their templates, extend editing types, handle actions differently using custom processors etc. We use that a lot with AdminUI. I like the idea but for the time being I think it's just best to extend what we have. This was my goal with this PR.
Maybe in the beginning of the next year there will be more time to do improvements or I will handle it as a Knowledge Friday task.

@bdunogier
Copy link
Member

!! Do not merge until #140 is merged. It has to be rebased onto master first !!

You can remove this, since #140 has been merged.

@bdunogier
Copy link
Member

No problem @webhdx. I don't imply that this should be applied to this PR anyway, the change is large enough as it is. If it helps you better understand what the intention was, it was good enough.

On the long term, it's more about building an architecture we can scale from. The rest is a set of details :)

@lserwatka lserwatka merged commit 4e9e47a into ezsystems:master Dec 7, 2017
@webhdx webhdx deleted the ezuser_integration branch February 23, 2018 08:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants