diff --git a/src/Symfony/Component/Routing/Loader/YamlFileLoader.php b/src/Symfony/Component/Routing/Loader/YamlFileLoader.php index b3ed099f8149..71503e4dc8f8 100644 --- a/src/Symfony/Component/Routing/Loader/YamlFileLoader.php +++ b/src/Symfony/Component/Routing/Loader/YamlFileLoader.php @@ -152,29 +152,36 @@ protected function parseImport(RouteCollection $collection, array $config, $path $this->setCurrentDir(dirname($path)); $subCollection = $this->import($config['resource'], $type, false, $file); - /* @var $subCollection RouteCollection */ - $subCollection->addPrefix($prefix); - if (null !== $host) { - $subCollection->setHost($host); + + if (!is_array($subCollection)) { + $subCollection = array($subCollection); } - if (null !== $condition) { - $subCollection->setCondition($condition); - } - if (null !== $schemes) { - $subCollection->setSchemes($schemes); - } - if (null !== $methods) { - $subCollection->setMethods($methods); - } - $subCollection->addDefaults($defaults); - $subCollection->addRequirements($requirements); - $subCollection->addOptions($options); - if (isset($config['name_prefix'])) { - $subCollection->addNamePrefix($config['name_prefix']); - } + /* @var $value RouteCollection */ + foreach ($subCollection as $value) { + $value->addPrefix($prefix); + if (null !== $host) { + $value->setHost($host); + } + if (null !== $condition) { + $value->setCondition($condition); + } + if (null !== $schemes) { + $value->setSchemes($schemes); + } + if (null !== $methods) { + $value->setMethods($methods); + } + $value->addDefaults($defaults); + $value->addRequirements($requirements); + $value->addOptions($options); - $collection->addCollection($subCollection); + if (isset($config['name_prefix'])) { + $value->addNamePrefix($config['name_prefix']); + } + + $collection->addCollection($value); + } } /**