Skip to content

Commit daa5652

Browse files
zepichmichaelgracious
authored andcommitted
Adjusted the types to DBAL 4.0/ORM 3.0
1 parent 2e7b0a1 commit daa5652

File tree

4 files changed

+12
-32
lines changed

4 files changed

+12
-32
lines changed

Type/Encrypted.php

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function getName()
3838
* @param AbstractPlatform $platform
3939
* @return string
4040
*/
41-
public function convertToPHPValue($value, AbstractPlatform $platform) : string
41+
public function convertToPHPValue($value, AbstractPlatform $platform): string
4242
{
4343
if (empty($value)) {
4444
return '';
@@ -58,7 +58,7 @@ public function convertToPHPValue($value, AbstractPlatform $platform) : string
5858
* @return mixed
5959
* @throws \Exception
6060
*/
61-
public function convertToDatabaseValue($value, AbstractPlatform $platform)
61+
public function convertToDatabaseValue($value, AbstractPlatform $platform): mixed
6262
{
6363
if (!isset($_ENV['ENABLE_ENCRYPTION']) || $_ENV['ENABLE_ENCRYPTION'] === 'false') {
6464
return $value;
@@ -74,12 +74,4 @@ public function convertToDatabaseValue($value, AbstractPlatform $platform)
7474
$encryptedValue = sodium_crypto_secretbox($value, $nonce, $key);
7575
return sodium_bin2hex($nonce).'|'.sodium_bin2hex($encryptedValue);
7676
}
77-
78-
/**
79-
* @inheritDoc
80-
*/
81-
public function requiresSQLCommentHint(AbstractPlatform $platform)
82-
{
83-
return true;
84-
}
8577
}

Type/EncryptedArrayCollection.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function convertToPHPValue($array, AbstractPlatform $platform): array
6969
* @return mixed
7070
* @throws \Exception
7171
*/
72-
public function convertToDatabaseValue($array, AbstractPlatform $platform)
72+
public function convertToDatabaseValue($array, AbstractPlatform $platform): mixed
7373
{
7474
if (!isset($_ENV['ENABLE_ENCRYPTION']) || $_ENV['ENABLE_ENCRYPTION'] === 'false') {
7575
return $array;
@@ -93,12 +93,4 @@ public function convertToDatabaseValue($array, AbstractPlatform $platform)
9393

9494
return json_encode($encryptedArray);
9595
}
96-
97-
/**
98-
* @inheritDoc
99-
*/
100-
public function requiresSQLCommentHint(AbstractPlatform $platform)
101-
{
102-
return true;
103-
}
10496
}

Type/Hashed.php

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ class Hashed extends Type
2020
*/
2121
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform): string
2222
{
23-
return $platform->getVarcharTypeDeclarationSQL($fieldDeclaration);
23+
$fieldDeclaration['length'] = 128;
24+
return $platform->getStringTypeDeclarationSQL($fieldDeclaration);
2425
}
2526

2627
/**
@@ -38,16 +39,8 @@ public function getName(): string
3839
* @param AbstractPlatform $platform
3940
* @return string
4041
*/
41-
public function convertToDatabaseValue($value, AbstractPlatform $platform) : string
42+
public function convertToDatabaseValue($value, AbstractPlatform $platform): string
4243
{
4344
return hash('whirlpool', $value);
4445
}
45-
46-
/**
47-
* @inheritDoc
48-
*/
49-
public function requiresSQLCommentHint(AbstractPlatform $platform)
50-
{
51-
return true;
52-
}
5346
}

composer.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,13 @@
66
"require": {
77
"php": "^7.2|^8.0|^8.1|^8.2",
88
"ext-sodium": "*",
9+
"ext-json": "*",
10+
"doctrine/dbal": "^4",
11+
"doctrine/orm": "^3",
12+
"doctrine/doctrine-bundle": "*",
13+
"doctrine/doctrine-migrations-bundle": "*",
914
"symfony/framework-bundle": "^4.0|^5.0|^6.0",
10-
"symfony/flex": "^1.0|^2.0",
11-
"symfony/orm-pack": "^2.0",
12-
"ext-json": "*"
15+
"symfony/flex": "^1.0|^2.0"
1316
},
1417
"license": "MIT",
1518
"authors": [

0 commit comments

Comments
 (0)