Skip to content

Commit e77c5a3

Browse files
committed
Merge branch '3.0.x' into 3.1.x
* 3.0.x: Fix annotation Bump CI workflows (#11336) Fix SchemaTool::getSchemaFromMetadata() uniqueConstraint without a predefined name (#11314)
2 parents 507c73c + c3cc0fd commit e77c5a3

File tree

6 files changed

+48
-12
lines changed

6 files changed

+48
-12
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ jobs:
9191
ENABLE_SECOND_LEVEL_CACHE: 1
9292

9393
- name: "Upload coverage file"
94-
uses: "actions/upload-artifact@v3"
94+
uses: "actions/upload-artifact@v4"
9595
with:
96-
name: "phpunit-${{ matrix.extension }}-${{ matrix.php-version }}-${{ matrix.dbal-version }}-coverage"
96+
name: "phpunit-${{ matrix.extension }}-${{ matrix.php-version }}-${{ matrix.dbal-version }}-${{ matrix.deps }}-coverage"
9797
path: "coverage*.xml"
9898

9999

@@ -164,9 +164,9 @@ jobs:
164164
run: "vendor/bin/phpunit -c ci/github/phpunit/pdo_pgsql.xml --coverage-clover=coverage.xml"
165165

166166
- name: "Upload coverage file"
167-
uses: "actions/upload-artifact@v3"
167+
uses: "actions/upload-artifact@v4"
168168
with:
169-
name: "${{ github.job }}-${{ matrix.postgres-version }}-${{ matrix.php-version }}-${{ matrix.dbal-version }}-coverage"
169+
name: "${{ github.job }}-${{ matrix.postgres-version }}-${{ matrix.php-version }}-${{ matrix.dbal-version }}-${{ matrix.extension }}-coverage"
170170
path: "coverage.xml"
171171

172172

@@ -230,7 +230,7 @@ jobs:
230230
run: "vendor/bin/phpunit -c ci/github/phpunit/${{ matrix.extension }}.xml --coverage-clover=coverage.xml"
231231

232232
- name: "Upload coverage file"
233-
uses: "actions/upload-artifact@v3"
233+
uses: "actions/upload-artifact@v4"
234234
with:
235235
name: "${{ github.job }}-${{ matrix.mariadb-version }}-${{ matrix.extension }}-${{ matrix.php-version }}-${{ matrix.dbal-version }}-coverage"
236236
path: "coverage.xml"
@@ -311,7 +311,7 @@ jobs:
311311
ENABLE_SECOND_LEVEL_CACHE: 1
312312

313313
- name: "Upload coverage files"
314-
uses: "actions/upload-artifact@v3"
314+
uses: "actions/upload-artifact@v4"
315315
with:
316316
name: "${{ github.job }}-${{ matrix.mysql-version }}-${{ matrix.extension }}-${{ matrix.php-version }}-${{ matrix.dbal-version }}-coverage"
317317
path: "coverage*.xml"
@@ -332,7 +332,7 @@ jobs:
332332
fetch-depth: 2
333333

334334
- name: "Download coverage files"
335-
uses: "actions/download-artifact@v3"
335+
uses: "actions/download-artifact@v4"
336336
with:
337337
path: "reports"
338338

.github/workflows/documentation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
uses: "shivammathur/setup-php@v2"
2828
with:
2929
coverage: "none"
30-
php-version: "8.2"
30+
php-version: "8.3"
3131

3232
- name: "Remove existing composer file"
3333
run: "rm composer.json"

.github/workflows/release-on-milestone-closed.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77

88
jobs:
99
release:
10-
uses: "doctrine/.github/.github/workflows/release-on-milestone-closed.yml@3.0.0"
10+
uses: "doctrine/.github/.github/workflows/release-on-milestone-closed.yml@4.0.0"
1111
secrets:
1212
GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }}
1313
GIT_AUTHOR_NAME: ${{ secrets.GIT_AUTHOR_NAME }}

.github/workflows/static-analysis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
uses: shivammathur/setup-php@v2
4444
with:
4545
coverage: none
46-
php-version: "8.2"
46+
php-version: "8.3"
4747
tools: cs2pr
4848

4949
- name: Require specific DBAL version
@@ -75,7 +75,7 @@ jobs:
7575
uses: shivammathur/setup-php@v2
7676
with:
7777
coverage: none
78-
php-version: "8.2"
78+
php-version: "8.3"
7979
tools: cs2pr
8080

8181
- name: Require specific DBAL version

src/Tools/SchemaTool.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ public function getSchemaFromMetadata(array $classes): Schema
337337

338338
if (isset($class->table['uniqueConstraints'])) {
339339
foreach ($class->table['uniqueConstraints'] as $indexName => $indexData) {
340-
$uniqIndex = new Index($indexName, $this->getIndexColumns($class, $indexData), true, false, [], $indexData['options'] ?? []);
340+
$uniqIndex = new Index('tmp__' . $indexName, $this->getIndexColumns($class, $indexData), true, false, [], $indexData['options'] ?? []);
341341

342342
foreach ($table->getIndexes() as $tableIndexName => $tableIndex) {
343343
if ($tableIndex->isFulfilledBy($uniqIndex)) {

tests/Tests/ORM/Tools/SchemaToolTest.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,27 @@ public function testConfigurationSchemaIgnoredEntity(): void
370370
self::assertTrue($schema->hasTable('first_entity'), 'Table first_entity should exist.');
371371
self::assertFalse($schema->hasTable('second_entity'), 'Table second_entity should not exist.');
372372
}
373+
374+
#[Group('GH-11314')]
375+
public function testLoadUniqueConstraintWithoutName(): void
376+
{
377+
$em = $this->getTestEntityManager();
378+
$entity = $em->getClassMetadata(GH11314Entity::class);
379+
380+
$schemaTool = new SchemaTool($em);
381+
$schema = $schemaTool->getSchemaFromMetadata([$entity]);
382+
383+
self::assertTrue($schema->hasTable('GH11314Entity'));
384+
385+
$tableEntity = $schema->getTable('GH11314Entity');
386+
387+
self::assertTrue($tableEntity->hasIndex('uniq_2d81a3ed5bf54558875f7fd5'));
388+
389+
$tableIndex = $tableEntity->getIndex('uniq_2d81a3ed5bf54558875f7fd5');
390+
391+
self::assertTrue($tableIndex->isUnique());
392+
self::assertSame(['field', 'anotherField'], $tableIndex->getColumns());
393+
}
373394
}
374395

375396
#[Table(options: ['foo' => 'bar', 'baz' => ['key' => 'val']])]
@@ -500,6 +521,21 @@ class IndexByFieldEntity
500521
public $fieldName;
501522
}
502523

524+
#[Entity]
525+
#[UniqueConstraint(columns: ['field', 'anotherField'])]
526+
class GH11314Entity
527+
{
528+
#[Column]
529+
#[Id]
530+
private int $id;
531+
532+
#[Column(name: 'field')]
533+
private string $field;
534+
535+
#[Column(name: 'anotherField')]
536+
private string $anotherField;
537+
}
538+
503539
class IncorrectIndexByFieldEntity
504540
{
505541
/** @var int */

0 commit comments

Comments
 (0)