@@ -17,9 +17,7 @@ final class CollectionValueObjectType extends Type
17
17
18
18
public function getSQLDeclaration (array $ column , AbstractPlatform $ platform ): string
19
19
{
20
- /** @var JsonType $typeInherit */
21
- $ typeInherit = $ this ->getType (Types::JSON );
22
- return $ typeInherit ->getSQLDeclaration ($ column , $ platform );
20
+ return $ this ->getInheritedType ()->getSQLDeclaration ($ column , $ platform );
23
21
}
24
22
25
23
/**
@@ -33,7 +31,7 @@ public static function getSupportedValueObjectType(): string
33
31
/**
34
32
* @inheritdoc
35
33
*/
36
- public function convertToDatabaseValue ($ value , AbstractPlatform $ platform ): ?string
34
+ public function convertToDatabaseValue (mixed $ value , AbstractPlatform $ platform ): ?string
37
35
{
38
36
if ($ value === null ) {
39
37
return null ;
@@ -42,19 +40,15 @@ public function convertToDatabaseValue($value, AbstractPlatform $platform): ?str
42
40
Assert::isInstanceOf ($ value , $ this ->class );
43
41
/** @var CollectionValueObject $value */
44
42
45
- /** @var JsonType $typeInherit */
46
- $ typeInherit = $ this ->getType (Types::JSON );
47
- return $ typeInherit ->convertToDatabaseValue ($ value ->toValue (), $ platform );
43
+ return $ this ->getInheritedType ()->convertToDatabaseValue ($ value ->toValue (), $ platform );
48
44
}
49
45
50
46
/**
51
47
* @inheritdoc
52
48
*/
53
- public function convertToPHPValue ($ value , AbstractPlatform $ platform ): ?CollectionValueObject
49
+ public function convertToPHPValue (mixed $ value , AbstractPlatform $ platform ): ?CollectionValueObject
54
50
{
55
- /** @var JsonType $typeInherit */
56
- $ typeInherit = $ this ->getType (Types::JSON );
57
- $ value = $ typeInherit ->convertToPHPValue ($ value , $ platform );
51
+ $ value = $ this ->getInheritedType ()->convertToPHPValue ($ value , $ platform );
58
52
59
53
if ($ value === null ) {
60
54
return null ;
@@ -68,4 +62,12 @@ public function convertToPHPValue($value, AbstractPlatform $platform): ?Collecti
68
62
69
63
return $ collection ;
70
64
}
65
+
66
+ private function getInheritedType (): JsonType
67
+ {
68
+ /** @var JsonType $type */
69
+ $ type = $ this ->getType (Types::JSON );
70
+
71
+ return $ type ;
72
+ }
71
73
}
0 commit comments