Skip to content

Commit

Permalink
USe constants instead of strings
Browse files Browse the repository at this point in the history
  • Loading branch information
Lustmored committed Feb 18, 2021
1 parent 61d81d2 commit 05f5cea
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 05f5cea

Please sign in to comment.