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

Bug/cms 9046 #2

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
44 changes: 42 additions & 2 deletions src/UnicodeTextType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)\'';
Expand All @@ -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';
}
}
}