-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement an EnumType for MySQL/MariaDB
- Loading branch information
Showing
12 changed files
with
291 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\DBAL\Exception\InvalidColumnType; | ||
|
||
use Doctrine\DBAL\Exception\InvalidColumnType; | ||
use Doctrine\DBAL\Platforms\AbstractPlatform; | ||
|
||
use function get_debug_type; | ||
use function sprintf; | ||
|
||
final class ColumnValuesRequired extends InvalidColumnType | ||
Check failure on line 13 in src/Exception/InvalidColumnType/ColumnValuesRequired.php GitHub Actions / Static Analysis with Psalm (8.3)MissingImmutableAnnotation
Check failure on line 13 in src/Exception/InvalidColumnType/ColumnValuesRequired.php GitHub Actions / Static Analysis with Psalm (8.3)MissingImmutableAnnotation
|
||
{ | ||
/** | ||
* @param AbstractPlatform $platform The target platform | ||
* @param string $type The SQL column type | ||
*/ | ||
public static function new(AbstractPlatform $platform, string $type): self | ||
{ | ||
return new self( | ||
sprintf( | ||
'%s requires the values of a %s column to be specified', | ||
get_debug_type($platform), | ||
$type, | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\DBAL\Types; | ||
|
||
use Doctrine\DBAL\Platforms\AbstractPlatform; | ||
|
||
final class EnumType extends Type | ||
{ | ||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function getSQLDeclaration(array $column, AbstractPlatform $platform): string | ||
{ | ||
return $platform->getEnumDeclarationSQL($column); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.