Unable to access "form.factory" service from Symfony 6 in ResourceController
h3llr4iser opened this issue · comments
Sylius resource bundle version affected: v1.10.2
Description
After upgrading to Symfony 6, an issue has arisen related to the "form.factory" service. This service is no longer public and cannot be retrieved directly from the container. This change is causing an error in the createForm method when I extend from ResourceController, which tries to fetch "form.factory" directly from the container.
Steps to reproduce
Upgrade to Symfony 6.
Use any controller that extends ResourceController and calls the createForm method.
Attempt to load a page that uses the controller.
Possible Solution
Update ResourceController (or ControllerTrait) to use dependency injection for accessing the "form.factory" service, instead of fetching it directly from the container. This change will align the code with Symfony's latest practices and ensure compatibility with Symfony 6.