diff --git a/composer.json b/composer.json index 8286f9d..fdefc19 100644 --- a/composer.json +++ b/composer.json @@ -1,9 +1,9 @@ { "name": "jadu/doctrine-types", "type": "library", - "require": { - "php": ">=7.4", - "doctrine/dbal": "^2.9" + "require": { + "php": ">=8.1", + "doctrine/dbal": "~3.7" }, "description": "Jadu Doctrine Types", "autoload": { diff --git a/src/UnicodeTextType.php b/src/UnicodeTextType.php index dd8e6c3..3a951dc 100644 --- a/src/UnicodeTextType.php +++ b/src/UnicodeTextType.php @@ -7,7 +7,15 @@ class UnicodeTextType extends Type { - public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) + /** + * Returns the SQL declaration for the given field. + * + * @param array $fieldDeclaration + * @param AbstractPlatform $platform + * + * @return string + */ + public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform): string { if ($platform->getName() === 'mysql') { return 'TEXT COMMENT \'(DC2Type:unicodetext)\''; @@ -17,23 +25,55 @@ public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $pla } } + /** + * Converts a value from the database representation to the PHP representation. + * + * @param mixed $value + * @param AbstractPlatform $platform + * + * @return mixed + */ + public function convertToPHPValue($value, AbstractPlatform $platform) { return $value; } + /** + * Converts a value from the PHP representation to the database representation. + * + * @param mixed $value + * @param AbstractPlatform $platform + * + * @return mixed + */ + public function convertToDatabaseValue($value, AbstractPlatform $platform) { return $value; } + /** + * Gets the name of this type. + * + * @return string + */ + public function getName() { return 'unicodetext'; } + /** + * Checks if this type requires a SQL comment hint. + * + * @param AbstractPlatform $platform + * + * @return bool + */ + public function requiresSQLCommentHint(AbstractPlatform $platform) { return $platform->getName() != 'mysql'; } -} \ No newline at end of file +}