Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
02cb00a
Fix error when use numeric for reference name
ovitores Jan 13, 2025
9ff177e
Merge pull request #517 from ovitores/1.8.x
greg0ire Mar 24, 2025
dac6321
Update doctrine/coding-standard requirement from ^12 to ^13
dependabot[bot] Mar 24, 2025
d700061
Update phpstan/phpstan requirement from 2.1.8 to 2.1.10
dependabot[bot] Mar 24, 2025
4778f14
Merge pull request #530 from doctrine/dependabot/composer/1.8.x/doctr…
derrabus Mar 24, 2025
9ef3b0d
Merge pull request #531 from doctrine/dependabot/composer/1.8.x/phpst…
greg0ire Mar 24, 2025
b95d2a8
Update phpstan/phpstan requirement from 2.1.10 to 2.1.11
dependabot[bot] Mar 25, 2025
cde7594
Merge pull request #532 from doctrine/dependabot/composer/1.8.x/phpst…
derrabus Mar 25, 2025
1d04968
Update phpstan/phpstan requirement from 2.1.11 to 2.1.12
dependabot[bot] Apr 17, 2025
f81f7bc
Merge pull request #533 from doctrine/dependabot/composer/1.8.x/phpst…
greg0ire Apr 17, 2025
ce1d9b4
Update phpstan/phpstan requirement from 2.1.12 to 2.1.13
dependabot[bot] Apr 28, 2025
2952803
Merge pull request #534 from doctrine/dependabot/composer/1.8.x/phpst…
SenseException Apr 28, 2025
14cc1fb
Update phpstan/phpstan requirement from 2.1.13 to 2.1.14
dependabot[bot] May 5, 2025
8c012b0
Merge pull request #535 from doctrine/dependabot/composer/1.8.x/phpst…
greg0ire May 5, 2025
c0bf167
Update phpstan/phpstan requirement from 2.1.14 to 2.1.15
dependabot[bot] May 14, 2025
40bafe5
Merge pull request #536 from doctrine/dependabot/composer/1.8.x/phpst…
greg0ire May 14, 2025
98deb24
Update phpstan/phpstan requirement from 2.1.15 to 2.1.16
dependabot[bot] May 16, 2025
f3fdfaa
Merge pull request #537 from doctrine/dependabot/composer/1.8.x/phpst…
greg0ire May 16, 2025
bb57825
Update phpstan/phpstan requirement from 2.1.16 to 2.1.17 (#538)
dependabot[bot] May 22, 2025
997e56a
Bump doctrine/.github from 7.2.2 to 7.3.0
dependabot[bot] Jun 9, 2025
6fb221d
Merge pull request #539 from doctrine/dependabot/github_actions/1.8.x…
greg0ire Jun 10, 2025
71f4570
Merge remote-tracking branch 'origin/1.8.x' into 2.0.x
greg0ire Jun 27, 2025
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 .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ on:
jobs:
coding-standards:
name: "Coding Standards"
uses: "doctrine/.github/.github/workflows/coding-standards.yml@7.2.2"
uses: "doctrine/.github/.github/workflows/coding-standards.yml@7.3.0"
2 changes: 1 addition & 1 deletion .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ on:
jobs:
documentation:
name: "Documentation"
uses: "doctrine/.github/.github/workflows/documentation.yml@7.2.2"
uses: "doctrine/.github/.github/workflows/documentation.yml@7.3.0"
2 changes: 1 addition & 1 deletion .github/workflows/release-on-milestone-closed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
jobs:
release:
name: "Git tag, release & create merge-up PR"
uses: "doctrine/.github/.github/workflows/release-on-milestone-closed.yml@7.2.2"
uses: "doctrine/.github/.github/workflows/release-on-milestone-closed.yml@7.3.0"
secrets:
GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }}
GIT_AUTHOR_NAME: ${{ secrets.GIT_AUTHOR_NAME }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ on:
jobs:
static-analysis:
name: "Static Analysis"
uses: "doctrine/.github/.github/workflows/phpstan.yml@7.2.2"
uses: "doctrine/.github/.github/workflows/phpstan.yml@7.3.0"
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
},
"require-dev": {
"ext-sqlite3": "*",
"doctrine/coding-standard": "^12",
"doctrine/coding-standard": "^13",
"doctrine/dbal": "^3.5 || ^4",
"doctrine/mongodb-odm": "^1.3.0 || ^2.0.0",
"doctrine/orm": "^2.14 || ^3",
"fig/log-test": "^1",
"phpstan/phpstan": "2.1.8",
"phpstan/phpstan": "2.1.17",
"phpunit/phpunit": "10.5.45",
"symfony/cache": "^6.4 || ^7",
"symfony/var-exporter": "^6.4 || ^7"
Expand Down
12 changes: 0 additions & 12 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -234,18 +234,6 @@ parameters:
count: 1
path: src/ReferenceRepository.php

-
message: '#^Property Doctrine\\Common\\DataFixtures\\ReferenceRepository\:\:\$identitiesByClass \(array\<class\-string, array\<string, mixed\>\>\) does not accept array\<string, array\<string, mixed\>\>\.$#'
identifier: assign.propertyType
count: 1
path: src/ReferenceRepository.php

-
message: '#^Property Doctrine\\Common\\DataFixtures\\ReferenceRepository\:\:\$referencesByClass \(array\<class\-string, array\<string, object\>\>\) does not accept array\<string, array\<string, object\>\>\.$#'
identifier: assign.propertyType
count: 1
path: src/ReferenceRepository.php

-
message: '#^Unable to resolve the template type T in call to method Doctrine\\Persistence\\ObjectManager\:\:getClassMetadata\(\)$#'
identifier: argument.templateType
Expand Down
9 changes: 6 additions & 3 deletions src/ReferenceRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

use function array_key_exists;
use function array_keys;
use function array_map;
use function sprintf;

/**
Expand All @@ -25,7 +26,7 @@ class ReferenceRepository
* List of named references to the fixture objects
* gathered during fixure loading
*
* @phpstan-var array<class-string, array<string, object>>
* @phpstan-var array<class-string, array<string|int, object>>
*/
private array $referencesByClass = [];

Expand Down Expand Up @@ -192,7 +193,7 @@ public function getReferenceNames(object $reference): array
return [];
}

return array_keys($this->referencesByClass[$class], $reference, true);
return array_map('strval', array_keys($this->referencesByClass[$class], $reference, true));
}

/**
Expand All @@ -218,7 +219,7 @@ public function getIdentitiesByClass(): array
/**
* Get all stored references
*
* @phpstan-return array<class-string, array<string, object>>
* @phpstan-return array<class-string, array<string|int, object>>
*/
public function getReferencesByClass(): array
{
Expand All @@ -237,6 +238,8 @@ public function getManager(): ObjectManager
* Get real class name of a reference that could be a proxy
*
* @param string $className Class name of reference object
*
* @return class-string
*/
protected function getRealClass(string $className): string
{
Expand Down
21 changes: 21 additions & 0 deletions tests/Common/DataFixtures/ReferenceRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,4 +242,25 @@ public function testGetIdentifierWhenHasNotBeenManagedYetByUnitOfWork(): void

$this->assertEquals($identitiesExpected, $identities['entity']);
}

public function testGivenAReferenceWithNameWithIntegerValueWhenGetReferenceNamesOfEntitiesThenReturnNamesInStringType(): void
{
$em = $this->getMockSqliteEntityManager();
$referenceRepository = new ReferenceRepository($em);

$schemaTool = new SchemaTool($em);
$schemaTool->dropSchema([]);
$schemaTool->createSchema([$em->getClassMetadata(Role::class)]);

$role = new Role();
$role->setName('role_name');
$em->persist($role);
$em->flush();

$name = (string) $role->getId();
$referenceRepository->setReference($name, $role);
$names = $referenceRepository->getReferenceNames($role);
$this->assertCount(1, $names);
$this->assertSame('1', $names[0]);
}
}