Giter Club home page Giter Club logo

Comments (2)

n3vrax avatar n3vrax commented on August 23, 2024

Hi,

I'll check into this, but it would be helpful to include the steps you have taken to overwrite the UserController and the error you get. There are a lot of reasons why it could fail.

As a side note, I'll publish in the future the best ways you can overwrite the UserController. Usually, it will be enough to overwrite UserService or hook into the RegisterEvent::EVENT_REGISTER_PRE event.

The UserController registerAction does nothing more that getting data from POST and validating it with the RegisterForm, than calling the UserService's register method. Given that you can hook into the RegisterForm events, to change form Elements(there is already an example in dot-frontend), or create a delegator factory to further change the RegisterForm creation process, this should be enough to customize the data you send and validate through POST to match you user data structure.

To customize the entire registration process, you can overwrite UserService register method instead, as we don't keep business logic into the controller.

Extending the UserController should be the last thing to consider, but it could be possible.

To summarize

  • all forms used by the dot-user package trigger init events you can listen and further customize them. This helps to adapt the forms to match your user data structures. You can also customize the forms by registering delegator factories for them(see zend-servicemanager documentation)
  • if you need to take custom actions pre/post some user action, you can hook into the triggered events(triggered by the UserService). See user_event_listeners module config key.
  • for maximum flexibility, you could overwrite UserService methods, but keep in mind you should trigger the events by yourself. I would not recommend this solution without understanding how the dot-user module works.

Indeed, this is not very well documented yet, but we'll try to make sure that no matter what method you decide to follow, it won't be a pain.

from frontend.

n3vrax avatar n3vrax commented on August 23, 2024

I'll close this, as the frontend was completely updated, the user module and the mapper module were redesigned from ground-up.

As means of extending the user module, I'm pretty certain that user controller can be overwritten and replaced in the routes config, or additional user controllers can be added to the same route key, user service can be overwritten, or the new event system can be used to hook into user events, for additional logic

from frontend.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.