Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/DependencyInjection/Compiler/DoctrineOrmMappingsPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;

use function method_exists;

/**
* Class for Symfony bundles to configure mappings for model classes not in the
* auto-mapped folder.
Expand Down Expand Up @@ -177,7 +179,12 @@ public static function createAnnotationMappingDriver(array $namespaces, array $d
*/
public static function createAttributeMappingDriver(array $namespaces, array $directories, array $managerParameters = [], $enabledParameter = false, array $aliasMap = [], bool $reportFieldsWhereDeclared = false)
{
$driver = new Definition(AttributeDriver::class, [$directories, $reportFieldsWhereDeclared]);
$driverArgs = [$directories];
if (method_exists(AttributeDriver::class, 'getReader')) {
$driverArgs[] = $reportFieldsWhereDeclared;
}

$driver = new Definition(AttributeDriver::class, $driverArgs);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be great to cover this method with a test that creates a container, adds the compiler pass returned by this method, compiles it and then attempts to retrieve the driver service from it.


return new DoctrineOrmMappingsPass($driver, $namespaces, $managerParameters, $enabledParameter, $aliasMap);
}
Expand Down
Loading