SymfonyCasts / reset-password-bundle

Need a killer reset password feature for your Symfony? Us too!
https://symfonycasts.com
MIT License
467 stars 65 forks source link

[docs] how-to multiple entities #318

Open jrushlow opened 4 months ago

jrushlow commented 4 months ago

fixes #110

Note: I was looking for a reason to add code into ResetPasswordBundle to facilitate multiple users, and I couldn't really find a solid reason why we need more code to make that happen. The solution I came up with is to support multiple entity relations in the ResetPasswordRequest entity (userland). This is where the ResetPasswordHelper (bundle) grabs the user object from to begin with, after all, the bundle really doesn't care what the user object is, so long that it is and object.

As the ResetPasswordRequest object is creating with make:reset-password or by the user directly - the only code change we need to make is over in MakerBundle. I'm still on the fence as to the best way to handle multiple users without adding too much complexity to and already complex make:reset-password

jrushlow commented 4 months ago

I should note - I would expect that the vast majority of projects have a single User entity, there are many that probably have 2 "user"-ish entities, anymore than 2 - you're beyond the scope of what either this bundle or MakerBundle are willing to handle (in terms of "generated code"). While it is possible to use this bundle for more than 2 entities - I don't see a make:reset-password --entity-count=6 anytime soon...