Skip to content

Commit 267b979

Browse files
committed
Feature: support for $pathsAsFilePaths
This commit adds support for a `$pathsAsFilePaths` parameter, introduced as part of doctrine/orm#12106 It adds a minor BC break (as well as was in the case of `$reportFieldsWhereDeclared` - `8d8579`) - classes, extending `DoctrineOrmMappingsPass` that override `createAttributeMappingDriver()` method will face signature mismatch.
1 parent 820d574 commit 267b979

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

src/DependencyInjection/Compiler/DoctrineOrmMappingsPass.php

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -141,23 +141,25 @@ public static function createAnnotationMappingDriver(array $namespaces, array $d
141141
}
142142

143143
/**
144-
* @param string[] $namespaces List of namespaces that are handled with attribute mapping
145-
* @param string[] $directories List of directories to look for classes with attributes
146-
* @param string[] $managerParameters List of parameters that could which object manager name
147-
* your bundle uses. This compiler pass will automatically
148-
* append the parameter name for the default entity manager
149-
* to this list.
150-
* @param string|false $enabledParameter Service container parameter that must be present to
151-
* enable the mapping. Set to false to not do any check,
152-
* optional.
153-
* @param string[] $aliasMap Map of alias to namespace.
154-
* @param bool $reportFieldsWhereDeclared Will report fields for the classes where they are declared
144+
* @param string[] $namespaces List of namespaces that are handled with attribute mapping
145+
* @param iterable<string> $paths Iterable of source file path names (if {@see $pathsAsFilePaths}),
146+
* or an array of directories where mapping classes can be found.
147+
* @param string[] $managerParameters List of parameters that could which object manager name
148+
* your bundle uses. This compiler pass will automatically
149+
* append the parameter name for the default entity manager
150+
* to this list.
151+
* @param string|false $enabledParameter Service container parameter that must be present to
152+
* enable the mapping. Set to false to not do any check,
153+
* optional.
154+
* @param string[] $aliasMap Map of alias to namespace.
155+
* @param bool $reportFieldsWhereDeclared Will report fields for the classes where they are declared
156+
* @param bool $pathsAsFilePaths whether {@see $paths} are paths to files or directories
155157
*
156158
* @return self
157159
*/
158-
public static function createAttributeMappingDriver(array $namespaces, array $directories, array $managerParameters = [], $enabledParameter = false, array $aliasMap = [], bool $reportFieldsWhereDeclared = false)
160+
public static function createAttributeMappingDriver(array $namespaces, iterable $paths, array $managerParameters = [], $enabledParameter = false, array $aliasMap = [], bool $reportFieldsWhereDeclared = false, bool $pathsAsFilePaths = false): self
159161
{
160-
$driver = new Definition(AttributeDriver::class, [$directories, $reportFieldsWhereDeclared]);
162+
$driver = new Definition(AttributeDriver::class, [$paths, $reportFieldsWhereDeclared, $pathsAsFilePaths]);
161163

162164
return new DoctrineOrmMappingsPass($driver, $namespaces, $managerParameters, $enabledParameter, $aliasMap);
163165
}

0 commit comments

Comments
 (0)