Skip to content

Commit 89ea9c2

Browse files
committed
#718 - YAML implementation
1 parent e5f19c2 commit 89ea9c2

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Routing/Loader/RestYamlCollectionLoader.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ public function load($file, $type = null)
7373
$namePrefix = isset($config['name_prefix']) ? $config['name_prefix'] : null;
7474
$parent = isset($config['parent']) ? $config['parent'] : null;
7575
$type = isset($config['type']) ? $config['type'] : null;
76+
$options = isset($config['options']) ? $config['options'] : null;
7677
$currentDir = dirname($path);
7778

7879
$parents = array();
@@ -93,6 +94,10 @@ public function load($file, $type = null)
9394
$this->collectionParents[$name] = $parents;
9495
}
9596

97+
if ($options) {
98+
$this->addOptionsToRoutes($options, $imported);
99+
}
100+
96101
$imported->addPrefix($prefix);
97102
$collection->addCollection($imported);
98103
} elseif (isset($config['pattern']) || isset($config['path'])) {
@@ -137,4 +142,11 @@ public function supports($resource, $type = null)
137142
'yml' === pathinfo($resource, PATHINFO_EXTENSION) &&
138143
'rest' === $type;
139144
}
145+
146+
protected function addOptionsToRoutes($options, RouteCollection $routesCollection)
147+
{
148+
foreach ($routesCollection as $route) {
149+
$route->addOptions($options);
150+
}
151+
}
140152
}

0 commit comments

Comments
 (0)