diff --git a/.phpstorm.meta.php b/.phpstorm.meta.php index 7dcade052c..c685ea2a81 100644 --- a/.phpstorm.meta.php +++ b/.phpstorm.meta.php @@ -1,8 +1,9 @@ ActionFactory::class, + ActionFactoryInterface::class => ActionFactoryInterface::class, AdminContextProvider::class => AdminContextProvider::class, AdminUrlGenerator::class => AdminUrlGenerator::class, CrudUrlGenerator::class => CrudUrlGenerator::class, diff --git a/config/services.php b/config/services.php index 63358166bf..c54526bfe2 100644 --- a/config/services.php +++ b/config/services.php @@ -8,6 +8,7 @@ use EasyCorp\Bundle\EasyAdminBundle\Cache\CacheWarmer; use EasyCorp\Bundle\EasyAdminBundle\Command\MakeAdminDashboardCommand; use EasyCorp\Bundle\EasyAdminBundle\Command\MakeCrudControllerCommand; +use EasyCorp\Bundle\EasyAdminBundle\Contracts\Factory\ActionFactoryInterface; use EasyCorp\Bundle\EasyAdminBundle\Contracts\Field\FieldConfiguratorInterface; use EasyCorp\Bundle\EasyAdminBundle\Contracts\Filter\FilterConfiguratorInterface; use EasyCorp\Bundle\EasyAdminBundle\Contracts\Menu\MenuItemMatcherInterface; @@ -249,7 +250,7 @@ ->set(EntityFactory::class) ->arg(0, service(FieldFactory::class)) - ->arg(1, service(ActionFactory::class)) + ->arg(1, service(ActionFactoryInterface::class)) ->arg(2, service(AuthorizationChecker::class)) ->arg(3, service('doctrine')) ->arg(4, service('event_dispatcher')) @@ -312,7 +313,8 @@ ->set(TextFilterConfigurator::class) - ->set(ActionFactory::class) + ->set(ActionFactoryInterface::class) + ->class(ActionFactory::class) ->arg(0, new Reference(AdminContextProvider::class)) ->arg(1, new Reference(AuthorizationChecker::class)) ->arg(2, new Reference(AdminUrlGenerator::class)) diff --git a/src/Attribute/AdminDashboard.php b/src/Attribute/AdminDashboard.php index eef97709d7..dfdda6a268 100644 --- a/src/Attribute/AdminDashboard.php +++ b/src/Attribute/AdminDashboard.php @@ -12,11 +12,11 @@ public function __construct( /** * @var string|null $routePath The path of the Symfony route that will be created for the dashboard (e.g. '/admin) */ - public /* ?string */ $routePath = null, + /* ?string */ public $routePath = null, /** * @var string|null $routeName The name of the Symfony route that will be created for the dashboard (e.g. 'admin') */ - public /* ?string */ $routeName = null, + /* ?string */ public $routeName = null, /** * @var array{ * requirements?: array, diff --git a/src/Contracts/Factory/ActionFactoryInterface.php b/src/Contracts/Factory/ActionFactoryInterface.php new file mode 100644 index 0000000000..99b5f75ed8 --- /dev/null +++ b/src/Contracts/Factory/ActionFactoryInterface.php @@ -0,0 +1,14 @@ + '?'.ManagerRegistry::class, 'event_dispatcher' => '?'.EventDispatcherInterface::class, - ActionFactory::class => '?'.ActionFactory::class, + ActionFactoryInterface::class => '?'.ActionFactoryInterface::class, AdminContextProvider::class => '?'.AdminContextProvider::class, AdminUrlGenerator::class => '?'.AdminUrlGenerator::class, ControllerFactory::class => '?'.ControllerFactory::class, diff --git a/src/Factory/ActionFactory.php b/src/Factory/ActionFactory.php index bdf8ebcc9f..010b38940e 100644 --- a/src/Factory/ActionFactory.php +++ b/src/Factory/ActionFactory.php @@ -6,6 +6,7 @@ use EasyCorp\Bundle\EasyAdminBundle\Config\Action; use EasyCorp\Bundle\EasyAdminBundle\Config\Crud; use EasyCorp\Bundle\EasyAdminBundle\Config\Option\EA; +use EasyCorp\Bundle\EasyAdminBundle\Contracts\Factory\ActionFactoryInterface; use EasyCorp\Bundle\EasyAdminBundle\Contracts\Provider\AdminContextProviderInterface; use EasyCorp\Bundle\EasyAdminBundle\Dto\ActionConfigDto; use EasyCorp\Bundle\EasyAdminBundle\Dto\ActionDto; @@ -22,7 +23,7 @@ /** * @author Javier Eguiluz */ -final class ActionFactory +final class ActionFactory implements ActionFactoryInterface { public function __construct( private readonly AdminContextProviderInterface $adminContextProvider, diff --git a/src/Factory/EntityFactory.php b/src/Factory/EntityFactory.php index cec0d8e907..018070068d 100644 --- a/src/Factory/EntityFactory.php +++ b/src/Factory/EntityFactory.php @@ -9,6 +9,7 @@ use EasyCorp\Bundle\EasyAdminBundle\Collection\ActionCollection; use EasyCorp\Bundle\EasyAdminBundle\Collection\EntityCollection; use EasyCorp\Bundle\EasyAdminBundle\Collection\FieldCollection; +use EasyCorp\Bundle\EasyAdminBundle\Contracts\Factory\ActionFactoryInterface; use EasyCorp\Bundle\EasyAdminBundle\Dto\ActionConfigDto; use EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto; use EasyCorp\Bundle\EasyAdminBundle\Event\AfterEntityBuiltEvent; @@ -24,12 +25,12 @@ final class EntityFactory { private FieldFactory $fieldFactory; - private ActionFactory $actionFactory; + private ActionFactoryInterface $actionFactory; private AuthorizationCheckerInterface $authorizationChecker; private ManagerRegistry $doctrine; private EventDispatcherInterface $eventDispatcher; - public function __construct(FieldFactory $fieldFactory, ActionFactory $actionFactory, AuthorizationCheckerInterface $authorizationChecker, ManagerRegistry $doctrine, EventDispatcherInterface $eventDispatcher) + public function __construct(FieldFactory $fieldFactory, ActionFactoryInterface $actionFactory, AuthorizationCheckerInterface $authorizationChecker, ManagerRegistry $doctrine, EventDispatcherInterface $eventDispatcher) { $this->fieldFactory = $fieldFactory; $this->actionFactory = $actionFactory;