Skip to content

Commit 689a5eb

Browse files
Do not check for Types::ENUM, because we want the enum to populate values with or without native enum.
Do not skip test on non-MySQL.
1 parent de9f00c commit 689a5eb

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

src/Mapping/ClassMetadata.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2209,11 +2209,7 @@ public function setDiscriminatorColumn(DiscriminatorColumnMapping|array|null $co
22092209
throw MappingException::nonEnumTypeMapped($this->name, $columnDef['fieldName'], $columnDef['enumType']);
22102210
}
22112211

2212-
if (
2213-
defined('Doctrine\DBAL\Types\Types::ENUM')
2214-
&& $columnDef['type'] === Types::ENUM
2215-
&& ! isset($columnDef['options']['values'])
2216-
) {
2212+
if (! isset($columnDef['options']['values'])) {
22172213
$columnDef['options']['values'] = array_column($columnDef['enumType']::cases(), 'value');
22182214
}
22192215
}

tests/Tests/ORM/Tools/SchemaToolTest.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
namespace Doctrine\Tests\ORM\Tools;
66

77
use Doctrine\Common\Collections\Collection;
8-
use Doctrine\DBAL\Platforms\AbstractMySQLPlatform;
98
use Doctrine\DBAL\Schema\ForeignKeyConstraintEditor;
109
use Doctrine\DBAL\Schema\Index as DbalIndex;
1110
use Doctrine\DBAL\Schema\Index\IndexedColumn;
@@ -14,7 +13,6 @@
1413
use Doctrine\DBAL\Schema\PrimaryKeyConstraintEditor;
1514
use Doctrine\DBAL\Schema\Table as DbalTable;
1615
use Doctrine\DBAL\Types\EnumType;
17-
use Doctrine\DBAL\Types\Types;
1816
use Doctrine\ORM\Mapping\ClassMetadata;
1917
use Doctrine\ORM\Mapping\Column;
2018
use Doctrine\ORM\Mapping\Entity;
@@ -57,7 +55,6 @@
5755
use function class_exists;
5856
use function count;
5957
use function current;
60-
use function defined;
6158
use function enum_exists;
6259
use function method_exists;
6360

@@ -282,18 +279,14 @@ public function testSetDiscriminatorColumnWithEnumType(): void
282279
self::markTestSkipped('Test valid for doctrine/dbal versions with EnumType only.');
283280
}
284281

285-
if (! $this->getTestEntityManager()->getConnection()->getDatabasePlatform() instanceof AbstractMySQLPlatform) {
286-
self::markTestSkipped('Test valid for MySQL/MariaDB only.');
287-
}
288-
289282
$em = $this->getTestEntityManager();
290283
$schemaTool = new SchemaTool($em);
291284
$metadata = $em->getClassMetadata(FirstEntity::class);
292285

293286
$metadata->setInheritanceType(ClassMetadata::INHERITANCE_TYPE_SINGLE_TABLE);
294287
$metadata->setDiscriminatorColumn([
295288
'name' => 'discriminator',
296-
'type' => 'enum',
289+
'type' => 'string',
297290
'enumType' => GH10288People::class,
298291
]);
299292

0 commit comments

Comments
 (0)