From 05f5ceadf56c9fac8fb343f1f75f1e2c2fba5e24 Mon Sep 17 00:00:00 2001 From: Jakub Caban Date: Thu, 18 Feb 2021 10:30:44 +0100 Subject: [PATCH] USe constants instead of strings --- lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php b/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php index a86b7090941..50d1380726a 100644 --- a/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php +++ b/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php @@ -26,6 +26,7 @@ use DateTimeImmutable; use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Types\Type; +use Doctrine\DBAL\Types\Types; use Doctrine\Instantiator\Instantiator; use Doctrine\Instantiator\InstantiatorInterface; use Doctrine\ORM\Cache\CacheException; @@ -1444,28 +1445,28 @@ private function _validateAndCompleteTypedFieldMapping(array $mapping): array ) { switch ($type->getName()) { case DateInterval::class: - $mapping['type'] = 'dateinterval'; + $mapping['type'] = Types::DATEINTERVAL; break; case DateTime::class: - $mapping['type'] = 'datetime'; + $mapping['type'] = Types::DATETIME_MUTABLE; break; case DateTimeImmutable::class: - $mapping['type'] = 'datetime_immutable'; + $mapping['type'] = Types::DATETIME_IMMUTABLE; break; case 'array': - $mapping['type'] = 'json'; + $mapping['type'] = Types::JSON; break; case 'bool': - $mapping['type'] = 'boolean'; + $mapping['type'] = Types::BOOLEAN; break; case 'float': - $mapping['type'] = 'float'; + $mapping['type'] = Types::FLOAT; break; case 'int': - $mapping['type'] = 'integer'; + $mapping['type'] = Types::INTEGER; break; case 'string': - $mapping['type'] = 'string'; + $mapping['type'] = Types::STRING; break; } }