-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[RFC][Routing] Be able to alias routes #7055
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
Comments
There was already an alias feature suggestion which was declined. |
Yes, I have seen that issue (#6088) but that wasn't about overriden methods, that was just about renaming routes.
Can I do that without using the |
I still think aliasing is bad. For one thing, you then have 2 routes for the same thing. E.g. admin_dashboard and sonata_admin_dashboard in your above example. And you will have inconsistent paths, as the overridden route by the third party bundle would still be generated with the old path and your new definition would be used in your code when generating urls. A probably better alternative would be to use the concept of extension. E.g.
In this case the route with the same name is not completely redefined, but instead it will reuse a route with the same name that was defined previously and only change the overriden options. It would be fairly easy to implement in the loader. On top of it one could allow defining the route name that one wants to extend ( |
@jfsimon I'm 👍 |
I'm not convinced that the extend mechanism is a good thing either. But if the patch is small enough, and if it does not introduce side effects, that might be something that we can add. Not a top priority tough. |
Closing as it will probably bring more confusion than anything else (see #6088.) |
I would like to see an alias feature in the Routing component.
Usage
If you have a project and you use the SonataAdminBundle, the dashboard is at
/admin/dashboard
. I don't like that and want to use/admin
. If we have an alias feature, we can do something like this:We can even bring it a step further and say that an alias will copy all route data in the new one and you can override very thing. That means we can do something like this:
What do you guys think of this new feature? If the reaction is positive, I will start looking at how to implement this in the Routing component.
The text was updated successfully, but these errors were encountered: