);
foreach ($locations as $location) {
$path = \CRM_Utils_File::addTrailingSlash(dirname($location)) . str_replace('\\', DIRECTORY_SEPARATOR, $namespace);
- try {
+ if (!file_exists($path) || !is_dir($path)) {
+ $resource = new \Symfony\Component\Config\Resource\FileExistenceResource($path);
+ $container->addResource($resource);
+ }
+ else {
$resource = new \Symfony\Component\Config\Resource\DirectoryResource($path, ';\.php$;');
- $addResource = FALSE;
foreach (glob("$path*.php") as $file) {
$matches = [];
preg_match('/(\w*)\.php$/', $file, $matches);
if ($serviceClass->isInstantiable()) {
$definition = $container->register(str_replace('\\', '_', $serviceName), $serviceName);
$definition->addTag($tag);
- $addResource = TRUE;
}
}
- if ($addResource) {
- $container->addResource($resource);
- }
- }
- catch (\InvalidArgumentException $e) {
- //Directory is not found so lets not do anything i suppose.
+ $container->addResource($resource);
}
}
}