Skip to content

Commit f3024b0

Browse files
committed
remove annotation driver checks
1 parent 8daf850 commit f3024b0

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

src/Doctrine/DoctrineHelper.php

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
use Doctrine\DBAL\Connection;
1515
use Doctrine\ORM\EntityManagerInterface;
16-
use Doctrine\ORM\Mapping\Driver\AnnotationDriver;
1716
use Doctrine\ORM\Mapping\Driver\AttributeDriver;
1817
use Doctrine\ORM\Mapping\MappingException as ORMMappingException;
1918
use Doctrine\ORM\Mapping\NamingStrategy;
@@ -147,18 +146,14 @@ public function getEntitiesForAutocomplete(): array
147146

148147
public function getMetadata(string $classOrNamespace = null, bool $disconnected = false): array|ClassMetadata
149148
{
150-
// Invalidating the cached AnnotationDriver::$classNames to find new Entity classes
149+
// Invalidating the cached AttributeDriver::$classNames to find new Entity classes
151150
foreach ($this->mappingDriversByPrefix ?? [] as $managerName => $prefixes) {
152-
foreach ($prefixes as [$prefix, $annotationDriver]) {
153-
if (null !== $annotationDriver) {
154-
if ($annotationDriver instanceof AnnotationDriver) {
155-
$classNames = (new \ReflectionClass(AnnotationDriver::class))->getProperty('classNames');
156-
} else {
157-
$classNames = (new \ReflectionClass(AttributeDriver::class))->getProperty('classNames');
158-
}
151+
foreach ($prefixes as [$prefix, $attributeDriver]) {
152+
if ($attributeDriver instanceof AttributeDriver) {
153+
$classNames = (new \ReflectionClass(AttributeDriver::class))->getProperty('classNames');
159154

160155
$classNames->setAccessible(true);
161-
$classNames->setValue($annotationDriver, null);
156+
$classNames->setValue($attributeDriver, null);
162157
}
163158
}
164159
}
@@ -184,14 +179,11 @@ public function getMetadata(string $classOrNamespace = null, bool $disconnected
184179
}
185180

186181
if (null === $this->mappingDriversByPrefix) {
187-
// Invalidating the cached AnnotationDriver::$classNames to find new Entity classes
182+
// Invalidating the cached AttributeDriver::$classNames to find new Entity classes
188183
$metadataDriver = $em->getConfiguration()->getMetadataDriverImpl();
184+
189185
if ($this->isInstanceOf($metadataDriver, MappingDriverChain::class)) {
190186
foreach ($metadataDriver->getDrivers() as $driver) {
191-
if ($this->isInstanceOf($driver, AnnotationDriver::class)) {
192-
$classNames->setValue($driver, null);
193-
}
194-
195187
if ($this->isInstanceOf($driver, AttributeDriver::class)) {
196188
$classNames->setValue($driver, null);
197189
}

0 commit comments

Comments
 (0)