Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .phpstorm.meta.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

namespace PHPSTORM_META {
use EasyCorp\Bundle\EasyAdminBundle\Contracts\Factory\ActionFactoryInterface;
use EasyCorp\Bundle\EasyAdminBundle\Provider\AdminContextProvider;
use EasyCorp\Bundle\EasyAdminBundle\Factory\ActionFactory;
use EasyCorp\Bundle\EasyAdminBundle\Factory\ActionFactoryInterface;
use EasyCorp\Bundle\EasyAdminBundle\Factory\EntityFactory;
use EasyCorp\Bundle\EasyAdminBundle\Factory\FormFactory;
use EasyCorp\Bundle\EasyAdminBundle\Factory\PaginatorFactory;
Expand All @@ -12,7 +13,7 @@
use EasyCorp\Bundle\EasyAdminBundle\Router\CrudUrlGenerator;

override(\Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait::get(), map([
ActionFactory::class => ActionFactory::class,
ActionFactoryInterface::class => ActionFactoryInterface::class,
AdminContextProvider::class => AdminContextProvider::class,
AdminUrlGenerator::class => AdminUrlGenerator::class,
CrudUrlGenerator::class => CrudUrlGenerator::class,
Expand Down
6 changes: 4 additions & 2 deletions config/services.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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'))
Expand Down Expand Up @@ -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))
Expand Down
4 changes: 2 additions & 2 deletions src/Attribute/AdminDashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, string>,
Expand Down
14 changes: 14 additions & 0 deletions src/Contracts/Factory/ActionFactoryInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace EasyCorp\Bundle\EasyAdminBundle\Contracts\Factory;

use EasyCorp\Bundle\EasyAdminBundle\Collection\ActionCollection;
use EasyCorp\Bundle\EasyAdminBundle\Dto\ActionConfigDto;
use EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto;

interface ActionFactoryInterface
{
public function processEntityActions(EntityDto $entityDto, ActionConfigDto $actionsDto): void;

public function processGlobalActions(?ActionConfigDto $actionsDto = null): ActionCollection;
}
4 changes: 2 additions & 2 deletions src/Controller/AbstractCrudController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use EasyCorp\Bundle\EasyAdminBundle\Config\Option\EA;
use EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext;
use EasyCorp\Bundle\EasyAdminBundle\Contracts\Controller\CrudControllerInterface;
use EasyCorp\Bundle\EasyAdminBundle\Contracts\Factory\ActionFactoryInterface;
use EasyCorp\Bundle\EasyAdminBundle\Dto\AssetsDto;
use EasyCorp\Bundle\EasyAdminBundle\Dto\BatchActionDto;
use EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto;
Expand All @@ -33,7 +34,6 @@
use EasyCorp\Bundle\EasyAdminBundle\Exception\EntityRemoveException;
use EasyCorp\Bundle\EasyAdminBundle\Exception\ForbiddenActionException;
use EasyCorp\Bundle\EasyAdminBundle\Exception\InsufficientEntityPermissionException;
use EasyCorp\Bundle\EasyAdminBundle\Factory\ActionFactory;
use EasyCorp\Bundle\EasyAdminBundle\Factory\ControllerFactory;
use EasyCorp\Bundle\EasyAdminBundle\Factory\EntityFactory;
use EasyCorp\Bundle\EasyAdminBundle\Factory\FilterFactory;
Expand Down Expand Up @@ -104,7 +104,7 @@ public static function getSubscribedServices(): array
return array_merge(parent::getSubscribedServices(), [
'doctrine' => '?'.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,
Expand Down
3 changes: 2 additions & 1 deletion src/Factory/ActionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -22,7 +23,7 @@
/**
* @author Javier Eguiluz <[email protected]>
*/
final class ActionFactory
final class ActionFactory implements ActionFactoryInterface
{
public function __construct(
private readonly AdminContextProviderInterface $adminContextProvider,
Expand Down
5 changes: 3 additions & 2 deletions src/Factory/EntityFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
Loading