Skip to content

Commit 8e8968a

Browse files
authored
Update DoctrineHelper.php (#1163)
Update doctrinehelper to work with symfony 4.4
1 parent f2b99ba commit 8e8968a

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/Doctrine/DoctrineHelper.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,18 @@ public function getMetadata(string $classOrNamespace = null, bool $disconnected
183183
// Invalidating the cached AnnotationDriver::$classNames to find new Entity classes
184184
foreach ($this->mappingDriversByPrefix ?? [] as $managerName => $prefixes) {
185185
foreach ($prefixes as [$prefix, $annotationDriver]) {
186-
if (null !== $annotationDriver) {
186+
if (null === $annotationDriver) {
187+
continue;
188+
}
189+
if (class_exists(AnnotationDriver::class)) {
190+
$classNames = (new \ReflectionClass(AnnotationDriver::class))->getProperty('classNames');
191+
}
192+
if ($annotationDriver instanceof AttributeDriver) {
193+
$classNames = (new \ReflectionClass(AttributeDriver::class))->getProperty('classNames');
194+
}
195+
196+
if (isset($classNames)) {
197+
$classNames->setAccessible(true);
187198
$classNames->setValue($annotationDriver, null);
188199
}
189200
}

0 commit comments

Comments
 (0)