Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DoctrineBridge] add support for the JSON type #43988

Merged
merged 1 commit into from Nov 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -189,6 +189,7 @@ public function getTypes($class, $property, array $context = [])
case self::$useDeprecatedConstants ? DBALType::TARRAY : Types::ARRAY:
// no break
case 'json_array':
case 'json':
return [new Type(Type::BUILTIN_TYPE_ARRAY, $nullable, null, true)];

case self::$useDeprecatedConstants ? DBALType::SIMPLE_ARRAY : Types::SIMPLE_ARRAY:
Expand Down Expand Up @@ -316,6 +317,7 @@ private function getPhpType(string $doctrineType): ?string
case self::$useDeprecatedConstants ? DBALType::SIMPLE_ARRAY : Types::SIMPLE_ARRAY:
// no break
case 'json_array':
case 'json':
return Type::BUILTIN_TYPE_ARRAY;
}

Expand Down
Expand Up @@ -254,11 +254,11 @@ public function typesProvider()
new Type(Type::BUILTIN_TYPE_INT),
new Type(Type::BUILTIN_TYPE_OBJECT, false, DoctrineRelation::class)
)]],
['json', null],
['json', [new Type(Type::BUILTIN_TYPE_ARRAY, true, null, true)]],
];

if (class_exists(Types::class)) {
$provider[] = ['json', null];
$provider[] = ['json', [new Type(Type::BUILTIN_TYPE_ARRAY, true, null, true)]];
}

return $provider;
Expand Down