Skip to content

Commit

Permalink
Compatibility with ORM 3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
mpdude committed Apr 8, 2024
1 parent d5ac89f commit 57c1056
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ jobs:
fail-fast: false
matrix:
include:
- { php-version: 8.1, symfony-locked-version: none, dependency-version: prefer-lowest }
- { php-version: 8.1, symfony-locked-version: 6.4.*, dependency-version: prefer-stable }
- { php-version: 8.2, symfony-locked-version: none, dependency-version: prefer-stable }
- { php-version: 8.3, symfony-locked-version: none, dependency-version: prefer-stable }
name: PHPUnit (PHP ${{matrix.php-version}}, Symfony Version Lock ${{ matrix.symfony-locked-version }}, ${{ matrix.dependency-version }})
- { php-version: 8.1, symfony-locked-version: none, orm-version: none, dependency-version: prefer-lowest }
- { php-version: 8.1, symfony-locked-version: 6.4.*, orm-version: '^2.18', dependency-version: prefer-stable }
- { php-version: 8.1, symfony-locked-version: 6.4.*, orm-version: none, dependency-version: prefer-stable }
- { php-version: 8.2, symfony-locked-version: none, orm-version: '^2.18', dependency-version: prefer-stable }
- { php-version: 8.3, symfony-locked-version: none, orm-version: none, dependency-version: prefer-stable }
name: PHPUnit (PHP ${{matrix.php-version}}, Symfony Version Lock ${{ matrix.symfony-locked-version }}, ORM Version ${{matrix.orm-version }}, ${{ matrix.dependency-version }})
steps:
- uses: actions/checkout@v3
- uses: shivammathur/setup-php@v2
Expand All @@ -34,6 +35,8 @@ jobs:
composer-${{ runner.os }}-${{ matrix.php-version }}-${{ matrix.symfony-locked-version }}-${{ matrix.dependency-version }}-
- run: VERSION=${{ matrix.symfony-locked-version }} .github/workflows/lock-symfony-version.sh
if: matrix.symfony-locked-version != 'none'
- run: composer require --no-update --no-interaction --no-scripts --no-progress --ansi doctrine/orm '${{ matrix.orm-version}}'
if: matrix.orm-version != 'none'
- run: composer update --${{ matrix.dependency-version }} --no-interaction --no-scripts --no-progress --ansi
- run: composer show
- run: vendor/bin/phpunit
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"doctrine/collections": "^1.0|^2.0",
"doctrine/dbal": "^2.3|^3.0",
"doctrine/event-manager": "^1.0|^2.0",
"doctrine/orm": "^2.13",
"doctrine/orm": "^2.19|^3.0",
"doctrine/persistence": "^1.3.8|^2.1|^3.1",
"psr/log": "^1.0|^2.0|^3.0",
"symfony/config": "^5.4|^6.4|^7.0",
Expand Down
12 changes: 6 additions & 6 deletions src/Doctrine/TranslatableClassMetadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Mapping\ClassMetadataFactory;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\Persistence\Mapping\RuntimeReflectionService;
use Psr\Log\LoggerInterface;
use ReflectionClass;
Expand Down Expand Up @@ -84,7 +84,7 @@ private function __construct(

public static function parseFromClass(string $class, ClassMetadataFactory $classMetadataFactory): ?self
{
/** @var ClassMetadataInfo $cm */
/** @var ClassMetadata $cm */
$cm = $classMetadataFactory->getMetadataFor($class);

$tm = new static($class);
Expand Down Expand Up @@ -179,7 +179,7 @@ private function assertAttributesAreComplete(string $class): void
}
}

private function findTranslatedProperties(ClassMetadataInfo $cm, ClassMetadataFactory $classMetadataFactory): void
private function findTranslatedProperties(ClassMetadata $cm, ClassMetadataFactory $classMetadataFactory): void
{
if (!$this->translationClass) {
return;
Expand Down Expand Up @@ -209,7 +209,7 @@ private function findTranslatedProperties(ClassMetadataInfo $cm, ClassMetadataFa
}
}

private function findTranslationsCollection(ClassMetadataInfo $cm, ClassMetadataFactory $classMetadataFactory): void
private function findTranslationsCollection(ClassMetadata $cm, ClassMetadataFactory $classMetadataFactory): void
{
foreach ($cm->associationMappings as $fieldName => $mapping) {
if (isset($mapping['declared'])) {
Expand All @@ -232,7 +232,7 @@ private function findTranslationsCollection(ClassMetadataInfo $cm, ClassMetadata
}
}

private function findPrimaryLocale(ClassMetadataInfo $cm): void
private function findPrimaryLocale(ClassMetadata $cm): void
{
foreach (array_merge([$cm->name], $cm->parentClasses) as $class) {
$reflectionClass = new ReflectionClass($class);
Expand All @@ -245,7 +245,7 @@ private function findPrimaryLocale(ClassMetadataInfo $cm): void
}
}

private function parseTranslationsEntity(ClassMetadataInfo $cm): void
private function parseTranslationsEntity(ClassMetadata $cm): void
{
foreach ($cm->fieldMappings as $fieldName => $mapping) {
$reflectionProperty = $cm->getReflectionProperty($fieldName);
Expand Down

0 comments on commit 57c1056

Please sign in to comment.