-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Routing][Config] Allow patterns of resources to be excluded from config loading #31587
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
[Routing][Config] Allow patterns of resources to be excluded from config loading #31587
Conversation
If you change |
Deprecations for |
fe50d64
to
3ffd4ee
Compare
3ffd4ee
to
af14114
Compare
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.
what about RoutingConfigurator
+ XmlFileLoader
?
also, do we want this in the DI component, where we also extend FileLoader
?
rebase needed btw :)
af14114
to
c15a7fe
Compare
@nicolas-grekas I've just added the modifications for the Also, I didn't find any BC rules reguarding a |
Yes, you can change a final method, no need for the func_get_arg trick |
No, we can't. This is not a BC break, that's why this change is OK :) |
ce09b71
to
96579e8
Compare
96579e8
to
c21f67b
Compare
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.
I took over the PR and finished the implementation. fabbot failure is a false-positive
@nicolas-grekas Great, thank you; I just learnt that we're 1 week away from feature freeze ;) |
is there anything missing to get this PR merged ? |
c21f67b
to
332ff88
Compare
I solved the conflicts on the PR. @fabpot is this PR good to merge ? |
Thank you @tristanbes. |
…cluded from config loading (tristanbes) This PR was merged into the 4.4 branch. Discussion ---------- [Routing][Config] Allow patterns of resources to be excluded from config loading | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | #31516 | License | MIT | Doc PR | not yet The PR will fix the following RFC: #31516 Like resource loading for services, this PR offers a way to exclude patterns of resources like: ```yml // config/routes/annotations.yaml controllers: resource: ../../src/Controller/* type: annotation exclude: '../src/Controller/{DebugEmailController}.php' ``` All the annotation routes inside `Controller/` will be loaded in this example except all the one present inside the `Controller/DebugEmailController.php` Commits ------- 332ff88 [Routing][Config] Allow patterns of resources to be excluded from config loading
if (\is_string($resource) && \strlen($resource) !== $i = strcspn($resource, '*?{[')) { | ||
$excluded = []; |
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.
Is it expected, that exclude
is only handled when the resource contains glob patterns (*?{[
)?
exclude
does not have any effect when using a directory as resource, like in default recipe:
https://github.com/symfony/recipes/blob/b364e60751fba4fc5da103304c1f61259d370e10/doctrine/annotations/1.0/config/routes/annotations.yaml#L2
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.
I stumbled upon the same issue and it cost me quite a lot of time to figure it out !
I do not believe this is working as intended, as it's different from what the documentation says.
To get my exclude
to work, I had to change my resource
too (add *):
controllers:
resource: '../../src/Controller'
exclude: '../../src/Controller/Backoffice/{HomepageController}.php'
does NOT work (HomepageController is not excluded)..
controllers:
resource: '../../src/Controller/*'
exclude: '../../src/Controller/Backoffice/{HomepageController}.php'
does work, the HomepageController is correctly excluded.
Without the *, the condition is not satisfied and the exclude is ignored totally, which makes no sense.
Should we open a new issue for this, @tristanbes ?
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.
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.
Hello, I guess you should open an issue if you think it's a bug or if this case should be handled
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.
It is indeed a bug. Do you need a new issue or handle it here ?
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.
Please create a new issue. Comments on already merged pull requests are likely to get lost.
The PR will fix the following RFC: #31516
Like resource loading for services, this PR offers a way to exclude patterns of resources like:
All the annotation routes inside
Controller/
will be loaded in this example except all the one present inside theController/DebugEmailController.php