Closed bakura10 closed 9 years ago
I get what problem you are trying to solve is, but win which way is this PR a solution to it?
Well, you can create a route that implements this interface. If no route name is passed to the assemble method of the router, then the router iterate through all routes, and check if one can try to assemble a route BASED on the params.
Why don't you implement this as a new path parser?
How would that help?
I gonna decline it for now (especially since the code changed quite a bit since then).
ping @ocramius
Hi,
This PR tries to solve an issue I have with ZfrRest. With ZF2 router and current Dash, the only way to assemble a route is to know its name:
However, routes are not always that simple. For instance, ZfrRest routes automatically traverses a hierarchy and can generate URI far beyond that what was defined in the "route" option. For instance, if a user has an association called "tweets", if you only define the "users" route with a "/users" path, ZfrRest may generate a lot of different URI: /users, /users/1, /users/2/tweets...
Because those routes are not actually defined in the config, there is currently no way to actually generate those URL without ugly hacks. What I'd like is actually letting my routes to decide if they can assemble something (based on parameters, options...). I could, for instance, use the router as follow:
The route could then decide to accept or reject the option. If the route returns true to "canAssemble", then the router let the given route to assemble.