From 4f709d36ff0029c6727b40ad566dc1fedd06424a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20S=C3=A9verin?= Date: Fri, 4 Jan 2019 11:57:14 +0000 Subject: [PATCH] Allow all datetime mappings to be used as version --- lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php b/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php index 3b3ecdaa3cb..e571d2ea76e 100644 --- a/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php +++ b/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php @@ -3042,9 +3042,9 @@ public function setVersionMapping(array &$mapping) $this->versionField = $mapping['fieldName']; if ( ! isset($mapping['default'])) { - if (in_array($mapping['type'], ['integer', 'bigint', 'smallint'])) { + if (in_array($mapping['type'], ['integer', 'bigint', 'smallint'], true)) { $mapping['default'] = 1; - } else if ($mapping['type'] == 'datetime') { + } else if (in_array($mapping['type'], ['datetime', 'datetime_immutable', 'datetimetz', 'datetimetz_immutable'], true)) { $mapping['default'] = 'CURRENT_TIMESTAMP'; } else { throw MappingException::unsupportedOptimisticLockingType($this->name, $mapping['fieldName'], $mapping['type']);