From b4611bb9af2d86dc8536696a88901a5c095b0134 Mon Sep 17 00:00:00 2001 From: Lars Vierbergen Date: Sun, 8 Feb 2015 16:26:52 +0100 Subject: [PATCH] Fix bug in RestYamlCollectionLoader that does not forward defaults and requirements. --- Routing/Loader/RestYamlCollectionLoader.php | 22 +++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/Routing/Loader/RestYamlCollectionLoader.php b/Routing/Loader/RestYamlCollectionLoader.php index 38b2c1815..82851940a 100644 --- a/Routing/Loader/RestYamlCollectionLoader.php +++ b/Routing/Loader/RestYamlCollectionLoader.php @@ -68,13 +68,15 @@ public function load($file, $type = null) // process routes and imports foreach ($config as $name => $config) { if (isset($config['resource'])) { - $resource = $config['resource']; - $prefix = isset($config['prefix']) ? $config['prefix'] : null; - $namePrefix = isset($config['name_prefix']) ? $config['name_prefix'] : null; - $parent = isset($config['parent']) ? $config['parent'] : null; - $type = isset($config['type']) ? $config['type'] : null; - $options = isset($config['options']) ? $config['options'] : null; - $currentDir = dirname($path); + $resource = $config['resource']; + $prefix = isset($config['prefix']) ? $config['prefix'] : null; + $namePrefix = isset($config['name_prefix']) ? $config['name_prefix'] : null; + $parent = isset($config['parent']) ? $config['parent'] : null; + $type = isset($config['type']) ? $config['type'] : null; + $requirements = isset($config['requirements']) ? $config['requirements'] : array(); + $defaults = isset($config['defaults']) ? $config['defaults'] : array(); + $options = isset($config['options']) ? $config['options'] : array(); + $currentDir = dirname($path); $parents = array(); if (!empty($parent)) { @@ -94,9 +96,9 @@ public function load($file, $type = null) $this->collectionParents[$name] = $parents; } - if ($options) { - $imported->addOptions($options); - } + $imported->addRequirements($requirements); + $imported->addDefaults($defaults); + $imported->addOptions($options); $imported->addPrefix($prefix); $collection->addCollection($imported);