Sylius / SyliusResourceBundle

Simpler CRUD for Symfony applications

Home Page:https://sylius.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to access "form.factory" service from Symfony 6 in ResourceController

h3llr4iser opened this issue · comments

commented

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.

ControllerTrait.php

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.