Sylius/SyliusResourceBundle

Automatically create and wire form type services when possible

rimas-kudelis opened this issue · 0 comments

The screenshot in the example here currently suggests that a form type service is being automatically created for every custom resource.

This is not true, but I think everyone would benefit if it actually were true. Sylius Standard automatically disables autowiring for all form types which extend AbstractResourceType. This means that we aren't getting any errors about Symfony's inability to autowire the constructor of AbstractResourceType, but whenever a form like that is actually used, the error still pops up, asking you to wire these two arguments manually.

It would be nice if the ResourceBundle's DI took care to wire these two arguments (class name and validation groups) for all forms which extend AbstractResourceType. This would allow us to avoid hardcoding the actual class name in the forms and would nicely complement the way other services (Controller, Factory, Manager, Repository) are created.