sonata-project / SonataAdminBundle

The missing Symfony Admin Generator
https://docs.sonata-project.org/projects/SonataAdminBundle
MIT License
2.11k stars 1.26k forks source link

Splitting the admin class or how to stop violating the SRP #3947

Closed greg0ire closed 2 years ago

greg0ire commented 8 years ago

The AbstractAdmin class is huge, with many unrelated responsabilities. We need plans and ideas to make it smaller, or even make it disappear (and any other class that does not seem to have a precise, focused goal). This should lead by also splitting the AdminInterface into something.

For instance, we could start by moving all security-related methods to a new service, and create a new Twig method called admin_is_granted instead of having people call admin.is_granted directly.

Also, I think we should think very hard before merging any new methods / properties in the Admin class. For instance, I probably should not have merged #3822 .

Of course, it will be quite hard to create components that are completely independent from the admin, so we should settle for tightly-coupled solutions like in #3791 , that should become less and less tighly coupled as we extract functionality into small services that we can inject into other, higher level services.

greg0ire commented 6 years ago

I think with that approach, it will be very clear what service is overriden thanks to debug:container --show-private

greg0ire commented 6 years ago

Tagging will be extremely easy to do with registerForAutoconfiguration(): https://github.com/symfony/symfony/blob/44b2f97dcd2ba10857dd545e424ad4f48c9dbea1/src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php#L154

github-actions[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

VincentLanglet commented 2 years ago

Closing due to lack of interest