Skip to content

Commit d374e70

Browse files
committed
made schemes and methods available in YamlFileLoader
1 parent 2834e7e commit d374e70

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/Symfony/Component/Routing/Loader/YamlFileLoader.php

+13-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
class YamlFileLoader extends FileLoader
2929
{
3030
private static $availableKeys = array(
31-
'resource', 'type', 'prefix', 'pattern', 'hostname_pattern', 'defaults', 'requirements', 'options',
31+
'resource', 'type', 'prefix', 'pattern', 'hostname_pattern', 'schemes', 'methods', 'defaults', 'requirements', 'options',
3232
);
3333

3434
/**
@@ -98,9 +98,11 @@ protected function parseRoute(RouteCollection $collection, $name, array $config,
9898
$defaults = isset($config['defaults']) ? $config['defaults'] : array();
9999
$requirements = isset($config['requirements']) ? $config['requirements'] : array();
100100
$options = isset($config['options']) ? $config['options'] : array();
101-
$hostnamePattern = isset($config['hostname_pattern']) ? $config['hostname_pattern'] : null;
101+
$hostnamePattern = isset($config['hostname_pattern']) ? $config['hostname_pattern'] : '';
102+
$schemes = isset($config['schemes']) ? $config['schemes'] : array();
103+
$methods = isset($config['methods']) ? $config['methods'] : array();
102104

103-
$route = new Route($config['pattern'], $defaults, $requirements, $options, $hostnamePattern);
105+
$route = new Route($config['pattern'], $defaults, $requirements, $options, $hostnamePattern, $schemes, $methods);
104106

105107
$collection->add($name, $route);
106108
}
@@ -121,6 +123,8 @@ protected function parseImport(RouteCollection $collection, array $config, $path
121123
$requirements = isset($config['requirements']) ? $config['requirements'] : array();
122124
$options = isset($config['options']) ? $config['options'] : array();
123125
$hostnamePattern = isset($config['hostname_pattern']) ? $config['hostname_pattern'] : null;
126+
$schemes = isset($config['schemes']) ? $config['schemes'] : null;
127+
$methods = isset($config['methods']) ? $config['methods'] : null;
124128

125129
$this->setCurrentDir(dirname($path));
126130

@@ -130,6 +134,12 @@ protected function parseImport(RouteCollection $collection, array $config, $path
130134
if (null !== $hostnamePattern) {
131135
$subCollection->setHostnamePattern($hostnamePattern);
132136
}
137+
if (null !== $schemes) {
138+
$subCollection->setSchemes($schemes);
139+
}
140+
if (null !== $methods) {
141+
$subCollection->setMethods($methods);
142+
}
133143
$subCollection->addDefaults($defaults);
134144
$subCollection->addRequirements($requirements);
135145
$subCollection->addOptions($options);

0 commit comments

Comments
 (0)