-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[FrameworkBundle][Routing] added Configurators to handle template and redirect controllers #30501
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
I'd really appreciate some help if anyone had already overridden some xsd schema thanks! |
a8de471
to
5fa4980
Compare
I've updated symfony/symfony-docs#11120 with a nice before/after view. Also I need to rebase on top of #30507. Xml config is working properly, but the IDE cannot resolve validation/autocompletion yet, this works thanks to the loader using its constant local path. Apart this last points, the feature is ready from side, only reviews needed now :), thanks! |
Thanks for working on this. To make this feature completely self-explanatory, I think we should rename |
This PR was merged into the 3.4 branch. Discussion ---------- [Routing] Fixed XML options resolution | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | ~ | License | MIT | Doc PR | ~ Found this bug while adding tests in #30501. I need it to be merged upward so it can get green there. Thanks! Commits ------- 53a6ff8 [Routing] Fixed XML options resolution
e251bae
to
a46c76a
Compare
… "format" in configuration (Jules Pietri) This PR was merged into the 4.3-dev branch. Discussion ---------- [Routing] Exposed "utf8" option, defaults "locale" and "format" in configuration | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | ~ | License | MIT | Doc PR | symfony/symfony-docs#11126 A sibling to #30501, everything is in the title :). Commits ------- 2911490 [Routing] Exposed "utf8" option, defaults "locale" and "format" in configuration
a46c76a
to
7055ba0
Compare
Rebased and squashed here, while I addressed @javiereguiluz's comment. Also, I was not happy with the xml definition because all attributes are there and it's hard to guess which one to use in which context, so I propose to use dedicated types instead: https://github.com/symfony/symfony/compare/a46c76a8c3a05adb7f984ea4d9cffbd3a446f3f5..7055ba0a5b09cec84d88f5c0447e79b65aa48a85#diff-96d406b9b38189be981bbea1bad334bd. Tests are passing locally and on travis, but not on windows.. I wonder how this line https://github.com/symfony/symfony/pull/30501/files#diff-44f544990841fe196e4ea5c76dcc18dfR8 can be a problem, if anyone has a clue on that topic that would be awesome. |
cfc48bc
to
8762eba
Compare
src/Symfony/Bundle/FrameworkBundle/Routing/Loader/PhpFileLoader.php
Outdated
Show resolved
Hide resolved
Did you consider this instead for the PHP-DSL? $routes->add('template_route', '/static')
->template('static.html.twig')
->maxAge(300)
->sharedMaxAge(100)
->private(true)
->methods(['GET'])
->options(['utf8' => true])
->condition('abc')
;
$routes->add('redirect_route', '/redirect')
->redirectToRoute('target_route')
->permanent(true)
->ignoreAttributes(['attr', 'ibutes'])
->keepRequestMethod(true)
->keepQueryParams(true)
->schemes(['http'])
->host('legacy')
->options(['utf8' => true])
;
$routes->add('url_redirect_route', '/redirect-url')
->redirectToUrl('/url-target')
->permanent(true)
->scheme('http')
->httpPort(1)
->httpsPort(2)
->keepRequestMethod(true)
->host('legacy')
->options(['utf8' => true]) |
src/Symfony/Bundle/FrameworkBundle/Routing/Loader/YamlFileLoader.php
Outdated
Show resolved
Hide resolved
c67da45
to
db3fdfd
Compare
Now that #34873 is merged, can you please rebase and take it into account to inject your new ContainerConfigurator? |
9e19392
to
528a5a9
Compare
528a5a9
to
beadeae
Compare
… redirect controllers
beadeae
to
de74794
Compare
Thank you @HeahDude. |
…le template and redirect controllers (HeahDude) This PR was merged into the 5.1-dev branch. Discussion ---------- [FrameworkBundle][Routing] added Configurators to handle template and redirect controllers | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | let's see | Fixed tickets | partially #24640, #25145 | License | MIT | Doc PR | symfony/symfony-docs#11120 While working on symfony/symfony-docs#11085, I felt bad about the long notations required for simple [redirects](https://symfony.com/doc/current/routing/redirect_in_config.html) and [templates rendering](https://symfony.com/doc/current/templating/render_without_controller.html) template actions, but I love and use those features since always. Then I gave it a try yesterday night and now I realised I missed #24640 and that #25145 has been closed x). So here we go, here's my WIP. WDYT of this implementation? ping @javiereguiluz? I'm going to open the PR in the docs so we can discuss the DX changes there too, and keep focus on the code here. Cheers! EDIT ---- This PR now only update PHP-DSL configurators. ______________ TODO: - [x] gather reviews - ~[x] fix xml schema~ - [x] add some tests - ~[ ] handle xsd auto discovery~ - [x] rebase on top of #30507 - [x] ~add shortcuts for #30514~ Commits ------- de74794 [FrameworkBundle][Routing] added Configurators to handle template and redirect controllers
src/Symfony/Component/Routing/Loader/Configurator/Traits/LocalizedRouteTrait.php
Show resolved
Hide resolved
…ude) This PR was merged into the 5.1-dev branch. Discussion ---------- [Routing] marked configurators traits as internal | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | Fix #30501 (comment) <!-- prefix each issue number with "Fix #", if any --> | License | MIT | Doc PR | not needed <!-- Replace this notice by a short README for your feature/bugfix. This will help people understand your PR and can be used as a start for the documentation. Additionally (see https://symfony.com/releases): - Always add tests and ensure they pass. - Never break backward compatibility (see https://symfony.com/bc). - Bug fixes must be submitted against the lowest maintained branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too.) - Features and deprecations must be submitted against branch master. --> Commits ------- 52efec7 [Routing] marked configurators traits as internal
…d Configurators to handle template and redirect controllers (HeahDude)" (nicolas-grekas) This PR was merged into the 5.1-dev branch. Discussion ---------- Revert "feature #30501 [FrameworkBundle][Routing] added Configurators to handle template and redirect controllers (HeahDude)" | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - This reverts commit 477ee19, reversing changes made to 9bfa258. The reverted PR is #30501. Actually, it's a partial revert: changes made to the `Routing` component are not reverted. The reason for this revert is that a discussion is still on-going in #35653 (which provides the same configuration extensions to yaml+xml), and we won't be able to resolve them in time for 5.1. Better postpone for 5.2. @HeahDude I invite you to open a PR after this one, reverting this very PR, which we'll consider again but for 5.2 if you don't mind. Commits ------- e4e8945 Revert "feature #30501 [FrameworkBundle][Routing] added Configurators to handle template and redirect controllers (HeahDude)"
While working on symfony/symfony-docs#11085, I felt bad about the long notations required for simple redirects and templates rendering template actions, but I love and use those features since always. Then I gave it a try yesterday night and now I realised I missed #24640 and that #25145 has been closed x).
So here we go, here's my WIP. WDYT of this implementation? ping @javiereguiluz?
I'm going to open the PR in the docs so we can discuss the DX changes there too, and keep focus on the code here.
Cheers!
EDIT
This PR now only update PHP-DSL configurators.
TODO:
[x] fix xml schema[ ] handle xsd auto discoveryadd shortcuts for [FrameworkBundle] Add a controller to send simple HTTP responses #30514