Merge pull request #6 from Tobion/hostname-routes

fix API of RouteCollection
This commit is contained in:
Arnaud Le Blanc 2012-11-12 04:09:53 -08:00
commit 17f51a1873

View File

@ -212,7 +212,9 @@ class RouteCollection implements \IteratorAggregate, \Countable
// necessarily already have it applied (depending on the order RouteCollections are added to each other)
$collection->addPrefix($this->getPrefix() . $prefix, $defaults, $requirements, $options);
$collection->setHostnamePattern($hostnamePattern);
if ('' !== $hostnamePattern) {
$collection->setHostnamePattern($hostnamePattern);
}
$this->routes[] = $collection;
}
@ -284,10 +286,6 @@ class RouteCollection implements \IteratorAggregate, \Countable
{
$this->hostnamePattern = (string) $pattern;
if ('' === $pattern) {
return;
}
foreach ($this->routes as $name => $route) {
$route->setHostnamePattern($pattern);
}