Skip to content

Commit 7be8d6e

Browse files
committed
Refactored deprecated ClassMetadataInfo class usages
1 parent ad7fd02 commit 7be8d6e

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

src/Repository/Interfaces/BaseRepositoryInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
use Doctrine\ORM\AbstractQuery;
1414
use Doctrine\ORM\EntityManager;
1515
use Doctrine\ORM\Exception\ORMException;
16-
use Doctrine\ORM\Mapping\ClassMetadataInfo;
16+
use Doctrine\ORM\Mapping\ClassMetadata;
1717
use Doctrine\ORM\NonUniqueResultException;
1818
use Doctrine\ORM\NoResultException;
1919
use Doctrine\ORM\OptimisticLockException;
@@ -58,7 +58,7 @@ public function getAssociations(): array;
5858
/**
5959
* Returns the ORM metadata descriptor for a class.
6060
*/
61-
public function getClassMetaData(): ClassMetadataInfo;
61+
public function getClassMetaData(): ClassMetadata;
6262

6363
/**
6464
* Getter method for EntityManager for current entity.

src/Repository/Traits/RepositoryWrappersTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
use App\Rest\UuidHelper;
1212
use Doctrine\ORM\EntityManager;
13-
use Doctrine\ORM\Mapping\ClassMetadataInfo;
13+
use Doctrine\ORM\Mapping\ClassMetadata;
1414
use Doctrine\ORM\QueryBuilder;
1515
use Ramsey\Uuid\Exception\InvalidUuidStringException;
1616
use UnexpectedValueException;
@@ -46,7 +46,7 @@ public function getAssociations(): array
4646
/**
4747
* @psalm-suppress ArgumentTypeCoercion
4848
*/
49-
public function getClassMetaData(): ClassMetadataInfo
49+
public function getClassMetaData(): ClassMetadata
5050
{
5151
return $this->getEntityManager()->getClassMetadata($this->getEntityName());
5252
}

tests/Integration/TestCase/EntityTestCase.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
use DeviceDetector\DeviceDetector;
2121
use Doctrine\Common\Collections\ArrayCollection;
2222
use Doctrine\ORM\EntityManagerInterface;
23-
use Doctrine\ORM\Mapping\ClassMetadataInfo;
23+
use Doctrine\ORM\Mapping\ClassMetadata;
2424
use PHPUnit\Framework\Attributes\DataProvider;
2525
use PHPUnit\Framework\Attributes\TestDox;
2626
use RuntimeException;
@@ -554,7 +554,7 @@ public static function dataProviderTestThatManyToManyAssociationMethodsWorksAsEx
554554

555555
$items = array_filter(
556556
$meta->getAssociationMappings(),
557-
static fn ($mapping): bool => $mapping['type'] === ClassMetadataInfo::MANY_TO_MANY
557+
static fn ($mapping): bool => $mapping['type'] === ClassMetadata::MANY_TO_MANY
558558
);
559559

560560
if (empty($items)) {
@@ -607,7 +607,7 @@ public static function dataProviderTestThatManyToOneAssociationMethodsWorksAsExp
607607

608608
$items = array_filter(
609609
$meta->getAssociationMappings(),
610-
static fn (array $mapping): bool => $mapping['type'] === ClassMetadataInfo::MANY_TO_ONE
610+
static fn (array $mapping): bool => $mapping['type'] === ClassMetadata::MANY_TO_ONE
611611
);
612612

613613
if (empty($items)) {
@@ -655,10 +655,10 @@ public static function dataProviderTestThatAssociationMethodsExists(): array
655655
];
656656

657657
switch ($mapping['type']) {
658-
case ClassMetadataInfo::ONE_TO_MANY:
659-
case ClassMetadataInfo::ONE_TO_ONE:
658+
case ClassMetadata::ONE_TO_MANY:
659+
case ClassMetadata::ONE_TO_ONE:
660660
break;
661-
case ClassMetadataInfo::MANY_TO_ONE:
661+
case ClassMetadata::MANY_TO_ONE:
662662
if ($meta->isReadOnly === false) {
663663
$methods[] = [
664664
'set' . ucfirst((string)$mapping['fieldName']),
@@ -668,7 +668,7 @@ public static function dataProviderTestThatAssociationMethodsExists(): array
668668
];
669669
}
670670
break;
671-
case ClassMetadataInfo::MANY_TO_MANY:
671+
case ClassMetadata::MANY_TO_MANY:
672672
self::assertArrayHasKey('fieldName', $mapping);
673673

674674
$singular = $mapping['fieldName'][mb_strlen((string)$mapping['fieldName']) - 1] === 's'
@@ -759,15 +759,15 @@ public static function dataProviderTestThatOneToManyAssociationMethodsWorksAsExp
759759

760760
$items = array_filter(
761761
$meta->getAssociationMappings(),
762-
static fn (array $mapping): bool => $mapping['type'] === ClassMetadataInfo::ONE_TO_MANY,
762+
static fn (array $mapping): bool => $mapping['type'] === ClassMetadata::ONE_TO_MANY,
763763
);
764764

765765
if (empty($items)) {
766766
$output = [
767767
[null, null, []],
768768
];
769769
} else {
770-
$output = array_merge(...array_values(array_map($iterator, $items)));
770+
$output = array_merge(...array_values(array_map($iterator, (array)$items)));
771771
}
772772

773773
return $output;

0 commit comments

Comments
 (0)