Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.5] Route: simplify RouteCollection. #18417

Closed
wants to merge 1 commit into from
Closed

[5.5] Route: simplify RouteCollection. #18417

wants to merge 1 commit into from

Conversation

lucasmichot
Copy link
Contributor

@lucasmichot lucasmichot commented Mar 19, 2017

Simplify RouteCollection using only one collection for the route storage.
There is no need to handle $allRoutes, $nameList and $actionList anymore.


This also makes the lookup refresh useless, as it's not necessary anymore.


Note:
the Travis build is failing because of another reason, related to orchestra/testbench, as in #18229, #18313 , #18400 & #18403

@taylorotwell
Copy link
Member

@themsaid any idea why this Travis build is failing? It seems like our requirements are fine? @crynobone

return isset($this->nameList[$name]) ? $this->nameList[$name] : null;
return $this->collection->first(function (Route $route) use ($name) {
return Arr::get($route->getAction(), 'as') === $name;
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this much slower than looking it up in a map? People may have many route(...) calls in their views.

return $this->collection->mapWithKeys(function (Route $route) {
foreach ($route->methods() as $method) {
return [$method => [$route->domain().$route->uri() => $route]];
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't this only return for the first method the route supports?

@lucasmichot lucasmichot deleted the feature/master/route-collection branch April 29, 2017 19:20
@lucasmichot lucasmichot restored the feature/master/route-collection branch June 20, 2017 15:49
@lucasmichot lucasmichot deleted the feature/master/route-collection branch June 26, 2017 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants