Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

Commit 5b174d3

Browse files
committed
Merge pull request #108 from eiannone/patch-1
Fix getting mapping files
2 parents bd72f74 + 4506b9c commit 5b174d3

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

DependencyInjection/CmfRoutingAutoExtension.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,10 @@ public function load(array $configs, ContainerBuilder $container)
4242
}
4343

4444
// add configured mapping file resources
45-
foreach ($config['mapping']['resources'] as $resource) {
46-
$resources[] = $resource;
45+
if (isset($config['mapping']['resources'])) {
46+
foreach ($config['mapping']['resources'] as $resource) {
47+
$resources[] = $resource;
48+
}
4749
}
4850
$container->setParameter('cmf_routing_auto.metadata.loader.resources', $resources);
4951

@@ -56,9 +58,11 @@ protected function findMappingFiles($bundles)
5658
{
5759
$resources = array();
5860
foreach ($bundles as $bundle) {
61+
$obj = new $bundle;
5962
foreach (array('xml', 'yml') as $extension) {
60-
if (file_exists($bundles->getPath().'/Resources/config/auto_routing.'.$extension)) {
61-
$resources[] = $extension;
63+
$path = $obj->getPath().'/Resources/config/auto_routing.'.$extension;
64+
if (file_exists($path)) {
65+
$resources[] = array('path' => $path, 'type' => null);
6266
}
6367
}
6468
}

0 commit comments

Comments
 (0)