You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Route process the Request themselves, i.e. in addition to providing information, they also process it.
What the problems do they make?
It would seem that having a collection of Route's, it is possible to "dump" (var_dump or other), but this will not work with the current implementation, because the Container will be dumped, in which there are links to the same Route and everything will be repeated in recursion.
There is no single point of processing Routes. Each Route is independent, but treats itself equally.
Solution
I suggest:
Return RouterInterface and make an independent Router
$route1 = newRoute('GET', 'home/index');
$route2 = newRoute('POST', 'home/index');
$router = newRouter($routes);
// or$router = $container->get(RouterInterface);
$router->injectRoutes($routes);
// or other ways to create the Router$response = $router->handle($request);
Conclusion
Now Route can be "dumped", exported or cached very easly.
Route "knows" no more than what it needs to know. Now it's just a DTO
A single point of processing all requests (the Router). It gives:
- The controlled process of matching any routes
- Now you can implement the storage of the current route being processed
- Other minor
The text was updated successfully, but these errors were encountered:
Problems
I see errors in the implementation of
Route
:Route
contains a container.Route
process theRequest
themselves, i.e. in addition to providing information, they also process it.What the problems do they make?
Route
's, it is possible to "dump" (var_dump
or other), but this will not work with the current implementation, because theContainer
will be dumped, in which there are links to the sameRoute
and everything will be repeated in recursion.Route
is independent, but treats itself equally.Solution
I suggest:
Return RouterInterface and make an independent RouterRemove container from RoutesRemove Request processing from RouteCurrent workflow:
Working with routes:
Future workflow:
Conclusion
Route
can be "dumped", exported or cached very easly.Route
"knows" no more than what it needs to know. Now it's just aDTO
Router
). It gives:- The controlled process of matching any routes
- Now you can implement the storage of the current route being processed
- Other minor
The text was updated successfully, but these errors were encountered: