Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0eacfd9

Browse files
committed
bug #43988 [DoctrineBridge] add support for the JSON type (dunglas)
This PR was merged into the 4.4 branch. Discussion ---------- [DoctrineBridge] add support for the JSON type | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | Fix api-platform/core#4547, api-platform/core#4553 | License | MIT | Doc PR | n/a The `json_array` Doctrine type is deprecated since DBAL 2.6 (we require version 2.7) and has been removed in DBAL 3.0 This PR adds back support for this new type. Commits ------- 1e218c5 [DoctrineBridge] add support for the JSON type
2 parents 070ed42 + 1e218c5 commit 0eacfd9

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ public function getTypes($class, $property, array $context = [])
189189
case self::$useDeprecatedConstants ? DBALType::TARRAY : Types::ARRAY:
190190
// no break
191191
case 'json_array':
192+
case 'json':
192193
return [new Type(Type::BUILTIN_TYPE_ARRAY, $nullable, null, true)];
193194

194195
case self::$useDeprecatedConstants ? DBALType::SIMPLE_ARRAY : Types::SIMPLE_ARRAY:
@@ -316,6 +317,7 @@ private function getPhpType(string $doctrineType): ?string
316317
case self::$useDeprecatedConstants ? DBALType::SIMPLE_ARRAY : Types::SIMPLE_ARRAY:
317318
// no break
318319
case 'json_array':
320+
case 'json':
319321
return Type::BUILTIN_TYPE_ARRAY;
320322
}
321323

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,11 +254,11 @@ public function typesProvider()
254254
new Type(Type::BUILTIN_TYPE_INT),
255255
new Type(Type::BUILTIN_TYPE_OBJECT, false, DoctrineRelation::class)
256256
)]],
257-
['json', null],
257+
['json', [new Type(Type::BUILTIN_TYPE_ARRAY, true, null, true)]],
258258
];
259259

260260
if (class_exists(Types::class)) {
261-
$provider[] = ['json', null];
261+
$provider[] = ['json', [new Type(Type::BUILTIN_TYPE_ARRAY, true, null, true)]];
262262
}
263263

264264
return $provider;

0 commit comments

Comments
 (0)