From de8a68c70de7d52355874b5d956fea9f41939a82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 19 Nov 2023 21:03:43 +0100 Subject: [PATCH] Expliticly declare a conversion from the custom TinyInt doctrine type to int This hopefully fixes issue #434 --- src/Doctrine/Types/TinyIntType.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Doctrine/Types/TinyIntType.php b/src/Doctrine/Types/TinyIntType.php index 9b2fc7a9..a1c732c3 100644 --- a/src/Doctrine/Types/TinyIntType.php +++ b/src/Doctrine/Types/TinyIntType.php @@ -41,6 +41,20 @@ class TinyIntType extends Type return 'tinyint'; } + /** + * {@inheritDoc} + * + * @param T $value + * + * @return (T is null ? null : int) + * + * @template T + */ + public function convertToPHPValue($value, AbstractPlatform $platform) + { + return $value === null ? null : (int) $value; + } + public function requiresSQLCommentHint(AbstractPlatform $platform): bool { //We use the comment, so that doctrine migrations can properly detect, that nothing has changed and no migration is needed.