Skip to content

Commit a63146a

Browse files
committed
Extend JsonType instead of reimplementing its functionality
1 parent 3c42e75 commit a63146a

3 files changed

Lines changed: 3 additions & 48 deletions

File tree

src/symfony/src/Doctrine/Type/AttestedCredentialDataType.php

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@
66

77
use Doctrine\DBAL\Platforms\AbstractPlatform;
88
use Doctrine\DBAL\Types\JsonType;
9-
use Doctrine\DBAL\Types\Type;
109
use Webauthn\AttestedCredentialData;
1110

12-
final class AttestedCredentialDataType extends Type
11+
final class AttestedCredentialDataType extends JsonType
1312
{
1413
use SerializerTrait;
1514

@@ -31,22 +30,8 @@ public function convertToPHPValue($value, AbstractPlatform $platform): ?Attested
3130
return $this->deserialize($value, AttestedCredentialData::class);
3231
}
3332

34-
public function getSQLDeclaration(array $column, AbstractPlatform $platform): string
35-
{
36-
return $platform->getJsonTypeDeclarationSQL($column);
37-
}
38-
3933
public function getName(): string
4034
{
4135
return 'attested_credential_data';
4236
}
43-
44-
public function requiresSQLCommentHint(AbstractPlatform $platform): bool
45-
{
46-
if (method_exists(JsonType::class, 'requiresSQLCommentHint')) {
47-
return (new JsonType())->requiresSQLCommentHint($platform);
48-
}
49-
50-
return false;
51-
}
5237
}

src/symfony/src/Doctrine/Type/PublicKeyCredentialDescriptorType.php

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@
66

77
use Doctrine\DBAL\Platforms\AbstractPlatform;
88
use Doctrine\DBAL\Types\JsonType;
9-
use Doctrine\DBAL\Types\Type;
109
use Webauthn\PublicKeyCredentialDescriptor;
1110

12-
final class PublicKeyCredentialDescriptorType extends Type
11+
final class PublicKeyCredentialDescriptorType extends JsonType
1312
{
1413
use SerializerTrait;
1514

@@ -31,22 +30,8 @@ public function convertToPHPValue($value, AbstractPlatform $platform): ?PublicKe
3130
return $this->deserialize($value, PublicKeyCredentialDescriptor::class);
3231
}
3332

34-
public function getSQLDeclaration(array $column, AbstractPlatform $platform): string
35-
{
36-
return $platform->getJsonTypeDeclarationSQL($column);
37-
}
38-
3933
public function getName(): string
4034
{
4135
return 'public_key_credential_descriptor';
4236
}
43-
44-
public function requiresSQLCommentHint(AbstractPlatform $platform): bool
45-
{
46-
if (method_exists(JsonType::class, 'requiresSQLCommentHint')) {
47-
return (new JsonType())->requiresSQLCommentHint($platform);
48-
}
49-
50-
return false;
51-
}
5237
}

src/symfony/src/Doctrine/Type/TrustPathDataType.php

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@
66

77
use Doctrine\DBAL\Platforms\AbstractPlatform;
88
use Doctrine\DBAL\Types\JsonType;
9-
use Doctrine\DBAL\Types\Type;
109
use Webauthn\TrustPath\TrustPath;
1110

12-
final class TrustPathDataType extends Type
11+
final class TrustPathDataType extends JsonType
1312
{
1413
use SerializerTrait;
1514

@@ -31,22 +30,8 @@ public function convertToPHPValue($value, AbstractPlatform $platform): ?TrustPat
3130
return $this->deserialize($value, TrustPath::class);
3231
}
3332

34-
public function getSQLDeclaration(array $column, AbstractPlatform $platform): string
35-
{
36-
return $platform->getJsonTypeDeclarationSQL($column);
37-
}
38-
3933
public function getName(): string
4034
{
4135
return 'trust_path';
4236
}
43-
44-
public function requiresSQLCommentHint(AbstractPlatform $platform): bool
45-
{
46-
if (method_exists(JsonType::class, 'requiresSQLCommentHint')) {
47-
return (new JsonType())->requiresSQLCommentHint($platform);
48-
}
49-
50-
return false;
51-
}
5237
}

0 commit comments

Comments
 (0)