-
Igor Wiedler authored
The challenge is to allow the RouteCollection to be mutable while making it possible to set Route names. We do not want to set the route name when creating the Controller (it must be optional, adding it after the closure is ugly as hell), and RouteCollection does not allow changing route names after they have been added. The way to solve this is to add a staging area for these routes. This staging area is the ControllerCollection. All defined controllers are added to this area. Once the flush() method is called on the ControllerContainer, the controllers are frozen (no name change possible) and added as routes to the RouteContainer. If you want to make use of the RouteCollection (for example: dumping out routes to the console), you must explicitly call flush() on the ControllerCollection. There was no good way to do this implicitly. The application will also call flush() if you use handle() or run(). TLDR: a) We can now set route names b) Call getControllerCollection()->flush() before getRouteCollection() c) We must document flushing d) Bulat is awesome
61e3ece6
Name |
Last commit
|
Last update |
---|---|---|
.. | ||
ControllerFrozenException.php |