diff --git a/src/Contracts/Controller/DashboardControllerInterface.php b/src/Contracts/Controller/DashboardControllerInterface.php index b6c9d08c55..04cd2323a3 100644 --- a/src/Contracts/Controller/DashboardControllerInterface.php +++ b/src/Contracts/Controller/DashboardControllerInterface.php @@ -7,7 +7,6 @@ use EasyCorp\Bundle\EasyAdminBundle\Config\Crud; use EasyCorp\Bundle\EasyAdminBundle\Config\Dashboard; use EasyCorp\Bundle\EasyAdminBundle\Config\Filters; -use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem; use EasyCorp\Bundle\EasyAdminBundle\Config\UserMenu; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Security\Core\User\UserInterface; diff --git a/src/Factory/FieldFactory.php b/src/Factory/FieldFactory.php index 6dd408235d..c9bcee2499 100644 --- a/src/Factory/FieldFactory.php +++ b/src/Factory/FieldFactory.php @@ -3,6 +3,7 @@ namespace EasyCorp\Bundle\EasyAdminBundle\Factory; use Doctrine\DBAL\Types\Type; +use Doctrine\DBAL\Types\Types; use EasyCorp\Bundle\EasyAdminBundle\Collection\FieldCollection; use EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto; use EasyCorp\Bundle\EasyAdminBundle\Dto\FieldDto; @@ -28,29 +29,29 @@ final class FieldFactory // TODO: update this map when ArrayField is implemented private static $doctrineTypeToFieldFqcn = [ //Type::TARRAY => 'array', - Type::BIGINT => TextField::class, - Type::BINARY => TextareaField::class, - Type::BLOB => TextareaField::class, - Type::BOOLEAN => BooleanField::class, - Type::DATE => DateField::class, - Type::DATE_IMMUTABLE => DateField::class, - Type::DATEINTERVAL => TextField::class, - Type::DATETIME => DateTimeField::class, - Type::DATETIME_IMMUTABLE => DateTimeField::class, - Type::DATETIMETZ => DateTimeField::class, - Type::DATETIMETZ_IMMUTABLE => DateTimeField::class, - Type::DECIMAL => NumberField::class, - Type::FLOAT => NumberField::class, - Type::GUID => TextField::class, - Type::INTEGER => IntegerField::class, - Type::JSON => TextField::class, - Type::OBJECT => TextField::class, - //Type::SIMPLE_ARRAY => 'array', - Type::SMALLINT => IntegerField::class, - Type::STRING => TextField::class, - Type::TEXT => TextareaField::class, - Type::TIME => TimeField::class, - Type::TIME_IMMUTABLE => TimeField::class, + Types::BIGINT => TextField::class, + Types::BINARY => TextareaField::class, + Types::BLOB => TextareaField::class, + Types::BOOLEAN => BooleanField::class, + Types::DATE_MUTABLE => DateField::class, + Types::DATE_IMMUTABLE => DateField::class, + Types::DATEINTERVAL => TextField::class, + Types::DATETIME_MUTABLE => DateTimeField::class, + Types::DATETIME_IMMUTABLE => DateTimeField::class, + Types::DATETIMETZ_MUTABLE => DateTimeField::class, + Types::DATETIMETZ_IMMUTABLE => DateTimeField::class, + Types::DECIMAL => NumberField::class, + Types::FLOAT => NumberField::class, + Types::GUID => TextField::class, + Types::INTEGER => IntegerField::class, + Types::JSON => TextField::class, + Types::OBJECT => TextField::class, + //Types::SIMPLE_ARRAY => 'array', + Types::SMALLINT => IntegerField::class, + Types::STRING => TextField::class, + Types::TEXT => TextareaField::class, + Types::TIME_MUTABLE => TimeField::class, + Types::TIME_IMMUTABLE => TimeField::class, ]; private $adminContextProvider; diff --git a/src/Factory/FilterFactory.php b/src/Factory/FilterFactory.php index aee6f3c016..99052fe6ce 100644 --- a/src/Factory/FilterFactory.php +++ b/src/Factory/FilterFactory.php @@ -2,7 +2,7 @@ namespace EasyCorp\Bundle\EasyAdminBundle\Factory; -use Doctrine\DBAL\Types\Type; +use Doctrine\DBAL\Types\Types; use EasyCorp\Bundle\EasyAdminBundle\Collection\FieldCollection; use EasyCorp\Bundle\EasyAdminBundle\Collection\FilterCollection; use EasyCorp\Bundle\EasyAdminBundle\Contracts\Filter\FilterInterface; @@ -26,30 +26,30 @@ final class FilterFactory private $adminContextProvider; private $filterConfigurators; private static $doctrineTypeToFilterClass = [ - Type::JSON_ARRAY => ArrayFilter::class, - Type::SIMPLE_ARRAY => ArrayFilter::class, - Type::TARRAY => ArrayFilter::class, - Type::JSON => TextFilter::class, - Type::BOOLEAN => BooleanFilter::class, - Type::DATE => DateTimeFilter::class, - Type::DATE_IMMUTABLE => DateTimeFilter::class, - Type::TIME => DateTimeFilter::class, - Type::TIME_IMMUTABLE => DateTimeFilter::class, - Type::DATETIME => DateTimeFilter::class, - Type::DATETIMETZ => DateTimeFilter::class, - Type::DATETIME_IMMUTABLE => DateTimeFilter::class, - Type::DATETIMETZ_IMMUTABLE => DateTimeFilter::class, - Type::DATEINTERVAL => ComparisonFilter::class, - Type::DECIMAL => NumericFilter::class, - Type::FLOAT => NumericFilter::class, - Type::BIGINT => NumericFilter::class, - Type::INTEGER => NumericFilter::class, - Type::SMALLINT => NumericFilter::class, - Type::GUID => TextFilter::class, - Type::STRING => TextFilter::class, - Type::BLOB => TextFilter::class, - Type::OBJECT => TextFilter::class, - Type::TEXT => TextFilter::class, + 'json_array' => ArrayFilter::class, + Types::SIMPLE_ARRAY => ArrayFilter::class, + Types::ARRAY => ArrayFilter::class, + Types::JSON => TextFilter::class, + Types::BOOLEAN => BooleanFilter::class, + Types::DATE_MUTABLE => DateTimeFilter::class, + Types::DATE_IMMUTABLE => DateTimeFilter::class, + Types::TIME_MUTABLE => DateTimeFilter::class, + Types::TIME_IMMUTABLE => DateTimeFilter::class, + Types::DATETIME_MUTABLE => DateTimeFilter::class, + Types::DATETIMETZ_MUTABLE => DateTimeFilter::class, + Types::DATETIME_IMMUTABLE => DateTimeFilter::class, + Types::DATETIMETZ_IMMUTABLE => DateTimeFilter::class, + Types::DATEINTERVAL => ComparisonFilter::class, + Types::DECIMAL => NumericFilter::class, + Types::FLOAT => NumericFilter::class, + Types::BIGINT => NumericFilter::class, + Types::INTEGER => NumericFilter::class, + Types::SMALLINT => NumericFilter::class, + Types::GUID => TextFilter::class, + Types::STRING => TextFilter::class, + Types::BLOB => TextFilter::class, + Types::OBJECT => TextFilter::class, + Types::TEXT => TextFilter::class, ]; public function __construct(AdminContextProvider $adminContextProvider, iterable $filterConfigurators) diff --git a/src/Filter/Configurator/NumericConfigurator.php b/src/Filter/Configurator/NumericConfigurator.php index a3795aeda9..68bb1a9cc2 100644 --- a/src/Filter/Configurator/NumericConfigurator.php +++ b/src/Filter/Configurator/NumericConfigurator.php @@ -2,7 +2,7 @@ namespace EasyCorp\Bundle\EasyAdminBundle\Filter\Configurator; -use Doctrine\DBAL\Types\Type; +use Doctrine\DBAL\Types\Types; use EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext; use EasyCorp\Bundle\EasyAdminBundle\Contracts\Filter\FilterConfiguratorInterface; use EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto; @@ -26,11 +26,11 @@ public function configure(FilterDto $filterDto, ?FieldDto $fieldDto, EntityDto $ { $propertyType = $entityDto->getPropertyMetadata($filterDto->getProperty())->get('type'); - if (Type::DECIMAL === $propertyType) { + if (Types::DECIMAL === $propertyType) { $filterDto->setFormTypeOptionIfNotSet('value_type_options.input', 'string'); } - if (\in_array($propertyType, [Type::BIGINT, Type::INTEGER, Type::SMALLINT], true)) { + if (\in_array($propertyType, [Types::BIGINT, Types::INTEGER, Types::SMALLINT], true)) { $filterDto->setFormTypeOptionIfNotSet('value_type', IntegerType::class); } } diff --git a/src/Filter/Configurator/TextConfigurator.php b/src/Filter/Configurator/TextConfigurator.php index ca884d87de..3ffda85e07 100644 --- a/src/Filter/Configurator/TextConfigurator.php +++ b/src/Filter/Configurator/TextConfigurator.php @@ -2,7 +2,7 @@ namespace EasyCorp\Bundle\EasyAdminBundle\Filter\Configurator; -use Doctrine\DBAL\Types\Type; +use Doctrine\DBAL\Types\Types; use EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext; use EasyCorp\Bundle\EasyAdminBundle\Contracts\Filter\FilterConfiguratorInterface; use EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto; @@ -26,11 +26,11 @@ public function configure(FilterDto $filterDto, ?FieldDto $fieldDto, EntityDto $ { $propertyType = $entityDto->getPropertyMetadata($filterDto->getProperty())->get('type'); - if (Type::JSON === $propertyType) { + if (Types::JSON === $propertyType) { $filterDto->setFormTypeOption('value_type', TextareaType::class); } - if (\in_array($propertyType, [Type::BLOB, Type::OBJECT, Type::TEXT], true)) { + if (\in_array($propertyType, [Types::BLOB, Types::OBJECT, Types::TEXT], true)) { $filterDto->setFormTypeOptionIfNotSet('value_type', TextareaType::class); } }