Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f020876

Browse filesBrowse files
bug #35987 [DoctrineBridge][DoctrineExtractor] Fix wrong guessed type for "json" type (fancyweb)
This PR was merged into the 3.4 branch. Discussion ---------- [DoctrineBridge][DoctrineExtractor] Fix wrong guessed type for "json" type | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | #35968 | License | MIT | Doc PR | - After checking the code, it appears that `json` have a different behavior than `json_array`. > In json_array doctrine was converting null or empty value to array, but json type doesn't do that @norkunas is right about this. Consequently, we cannot safely guess a built in type for the `json` Doctrine type. Commits ------- f9f5f8d [DoctrineBridge][DoctrineExtractor] Fix wrong guessed type for "json" type
2 parents c561eb0 + f9f5f8d commit f020876
Copy full SHA for f020876

File tree

2 files changed

+1
-3
lines changed
Filter options

2 files changed

+1
-3
lines changed

‎src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ public function getTypes($class, $property, array $context = [])
178178
switch ($typeOfField) {
179179
case self::$useDeprecatedConstants ? DBALType::TARRAY : 'array':
180180
case 'json_array':
181-
case self::$useDeprecatedConstants ? false : Types::JSON:
182181
return [new Type(Type::BUILTIN_TYPE_ARRAY, $nullable, null, true)];
183182

184183
case self::$useDeprecatedConstants ? DBALType::SIMPLE_ARRAY : Types::SIMPLE_ARRAY:
@@ -266,7 +265,6 @@ private function getPhpType($doctrineType)
266265
case self::$useDeprecatedConstants ? DBALType::TARRAY : 'array':
267266
case self::$useDeprecatedConstants ? DBALType::SIMPLE_ARRAY : Types::SIMPLE_ARRAY:
268267
case 'json_array':
269-
case self::$useDeprecatedConstants ? false : Types::JSON:
270268
return Type::BUILTIN_TYPE_ARRAY;
271269
}
272270

‎src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ public function typesProvider()
182182
];
183183

184184
if (class_exists(Types::class)) {
185-
$provider[] = ['json', [new Type(Type::BUILTIN_TYPE_ARRAY, true, null, true)]];
185+
$provider[] = ['json', null];
186186
}
187187

188188
return $provider;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.