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

Drop support for DBAL 4.1 #11670

Merged
merged 1 commit into from
Oct 12, 2024
Merged
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
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"composer-runtime-api": "^2",
"ext-ctype": "*",
"doctrine/collections": "^2.2",
"doctrine/dbal": "^4",
"doctrine/dbal": "^4.2.1",
"doctrine/deprecations": "^0.5.3 || ^1",
"doctrine/event-manager": "^1.2 || ^2",
"doctrine/inflector": "^1.4 || ^2.0",
Expand Down
7 changes: 1 addition & 6 deletions src/Mapping/ClassMetadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
use function assert;
use function class_exists;
use function count;
use function defined;
use function enum_exists;
use function explode;
use function in_array;
Expand Down Expand Up @@ -1233,11 +1232,7 @@ protected function validateAndCompleteFieldMapping(array $mapping): FieldMapping
$this->containsEnumIdentifier = true;
}

if (
defined('Doctrine\DBAL\Types\Types::ENUM')
&& $mapping->type === Types::ENUM
&& ! isset($mapping->options['values'])
) {
if ($mapping->type === Types::ENUM && ! isset($mapping->options['values'])) {
$mapping->options['values'] = array_column($mapping->enumType::cases(), 'value');
}
}
Expand Down
6 changes: 1 addition & 5 deletions src/Mapping/DefaultTypedFieldMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

use function array_merge;
use function assert;
use function defined;
use function enum_exists;
use function is_a;

Expand Down Expand Up @@ -57,10 +56,7 @@ public function validateAndComplete(array $mapping, ReflectionProperty $field):
if (
! $type->isBuiltin()
&& enum_exists($type->getName())
&& (! isset($mapping['type']) || (
defined('Doctrine\DBAL\Types\Types::ENUM')
&& $mapping['type'] === Types::ENUM
))
&& (! isset($mapping['type']) || $mapping['type'] === Types::ENUM)
) {
$reflection = new ReflectionEnum($type->getName());
if (! $reflection->isBacked()) {
Expand Down
9 changes: 2 additions & 7 deletions tests/Tests/ORM/Functional/EnumTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Doctrine\Tests\ORM\Functional;

use Doctrine\DBAL\Types\EnumType;
use Doctrine\ORM\AbstractQuery;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Driver\AttributeDriver;
Expand All @@ -27,7 +26,6 @@
use Doctrine\Tests\OrmFunctionalTestCase;
use PHPUnit\Framework\Attributes\DataProvider;

use function class_exists;
use function dirname;
use function sprintf;
use function uniqid;
Expand Down Expand Up @@ -460,11 +458,8 @@ public static function provideCardClasses(): iterable
{
yield Card::class => [Card::class];
yield TypedCard::class => [TypedCard::class];

if (class_exists(EnumType::class)) {
yield CardNativeEnum::class => [CardNativeEnum::class];
yield TypedCardNativeEnum::class => [TypedCardNativeEnum::class];
}
yield CardNativeEnum::class => [CardNativeEnum::class];
yield TypedCardNativeEnum::class => [TypedCardNativeEnum::class];
}

public function testItAllowsReadingAttributes(): void
Expand Down
Loading