Skip to content

Commit 82fb7b1

Browse files
Fix attribute driver mapping pass compatibility with ORM 3
1 parent d088386 commit 82fb7b1

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/DependencyInjection/Compiler/DoctrineOrmMappingsPass.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
use Symfony\Component\DependencyInjection\Definition;
1717
use Symfony\Component\DependencyInjection\Reference;
1818

19+
use function method_exists;
20+
1921
/**
2022
* Class for Symfony bundles to configure mappings for model classes not in the
2123
* auto-mapped folder.
@@ -177,7 +179,12 @@ public static function createAnnotationMappingDriver(array $namespaces, array $d
177179
*/
178180
public static function createAttributeMappingDriver(array $namespaces, array $directories, array $managerParameters = [], $enabledParameter = false, array $aliasMap = [], bool $reportFieldsWhereDeclared = false)
179181
{
180-
$driver = new Definition(AttributeDriver::class, [$directories, $reportFieldsWhereDeclared]);
182+
$driverArgs = [$directories];
183+
if (method_exists(AttributeDriver::class, 'getReader')) {
184+
$driverArgs[] = $reportFieldsWhereDeclared;
185+
}
186+
187+
$driver = new Definition(AttributeDriver::class, $driverArgs);
181188

182189
return new DoctrineOrmMappingsPass($driver, $namespaces, $managerParameters, $enabledParameter, $aliasMap);
183190
}

0 commit comments

Comments
 (0)