-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Routing] Changing RouteCollectionBuilder::import() behavior to add to the builder #16477
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
Conversation
… to the collection
* | ||
* @param mixed $resource | ||
* @param string $prefix | ||
* @param string $type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
string|null
Ping @symfony/deciders - this is totally subjective, but we should decide either way. |
Would it be possible to change |
@henrikbjorn The $adminRoutes = $routes->import(__DIR__.'/config/admin.yml', '/admin');
$adminRoutes->setDefault('_locale', 'fr'); Is that what you're after? Btw, I saw your Muse test app - thanks for testing things. |
@weaverryan almost, i can think of cases where i want the "old" behavior where it isnt automatically added. That is what i want No problem :) |
@henrikbjorn What's your use-case for that? Obviously making |
If i wanted to build something using this class by itself then it would be a good idea to have a immutable option of loading routes. But maybe i am grasping for straws (thats a thing right?) |
@henrikbjorn Ha, it is a thing ;). I still don't quite understand the mutable versus immutable thing and what use-case you're thinking of. But not necessarily because what you're asking doesn't make sense - I may just need more info. Can you give a code example of what you might want to accomplish that isn't possible/easy with the current interface? Would the change in this PR improve things, or not matter? |
The change currently does exactly what is was assuming it would do eg |
I see an inconsistency in method signatures: function import($resource, $prefix = '/', $type = null)
function mount($prefix, RouteCollectionBuilder $builder) I perceive |
@GromNaN I don't understand, what would you change? |
Btw, if we're going to merge this or make any other changes... it needs to happen... like yesterday :). So any constructive 👍 , 👎 or specific changes would be ideal |
@weaverryan he wants the $builder to be the first argument to mount, which makes sense to me. |
👍 |
I'd still like to see this merged - as I was just thinking how @symfony/deciders can we either close or merge this? |
This change makes it more understandable what happens 👍 |
Thank you @weaverryan. |
Based on conversation starting here: #15990 (comment).
This makes
import()
actually add theRouteCollectionBuilder
into itself. We didn't do this before at Fabien's request, and actually the current implementation (before this PR) is quite "clean". However, I agree with @wouterj thatimport()
really sounds/looks like it will actually import those routes into thisRouteCollectionBuilder
.This change is subjective - we just need to pick which way we like better and run full steam with it.