-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[FrameworkBundle] Improve the DX of TemplateController when using SF 4 #24637
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
Moving to 4.1. 3.4 is closed for new features. |
@dunglas Inside a |
@@ -91,4 +91,9 @@ public function templateAction($template, $maxAge = null, $sharedAge = null, $pr | |||
|
|||
return $response; | |||
} | |||
|
|||
public function __invoke($template, $maxAge = null, $sharedAge = null, $private = null) |
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.
we can now use PHP 7.1 features 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.
done
dbbf3c1
to
c14786b
Compare
c14786b
to
6d15055
Compare
Failure not related |
Thank you @dunglas. |
… when using SF 4 (dunglas) This PR was merged into the 4.1-dev branch. Discussion ---------- [FrameworkBundle] Improve the DX of TemplateController when using SF 4 | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no <!-- don't forget to update UPGRADE-*.md files --> | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a Tiny DX improvement when using modern Symfony. Allow to write: ```yaml # config/routes.yaml index: path: / defaults: _controller: 'Symfony\Bundle\FrameworkBundle\Controller\TemplateController' template: 'homepage.html.twig' ``` Instead of: ```yaml index: path: / defaults: _controller: 'Symfony\Bundle\FrameworkBundle\Controller\TemplateController::templateAction' template: 'homepage.html.twig' ``` I was thinking about doing the same for `RedirectController`, but it's not that easy because it contains two methods. Commits ------- 6d15055 [FrameworkBundle] Improve the DX of TemplateController when using SF 4
This PR was merged into the 4.1-dev branch. Discussion ---------- [DI] Allow for invokable event listeners | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #... <!-- #-prefixed issue number(s), if any --> | License | MIT | Doc PR | symfony/symfony-docs#... <!--highly recommended for new features--> Inspired by #24637 / #25259. This adds invokable support for event listeners :) ```yaml Some\Foo: tags: [{ name: kernel.event_listener, event: kernel.request }] ``` ```php class Foo { public function __invoke(GetResponseEvent $event) { } } ``` Commits ------- fa5b7eb [DI] Allow for invokable event listeners
…dunglas) This PR was merged into the 4.1 branch. Discussion ---------- [FrameworkBundle] Improve the DX of TemplateController symfony/symfony#24637 Commits ------- fca1a5b [FrameworkBundle] Improve the DX of TemplateController
…en using RedirectController (yceruto) This PR was merged into the 4.4 branch. Discussion ---------- [FrameworkBundle][DX] Improving the redirect config when using RedirectController | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | symfony/symfony-docs#12189 follow-up #24637 **Before:** ```yaml # config/routes.yaml doc_shortcut: path: /doc controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController::redirectAction defaults: route: 'doc_page' legacy_doc: path: /legacy/doc controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController::urlRedirectAction defaults: path: 'https://legacy.example.com/doc' ``` **After:** ```yaml # config/routes.yaml doc_shortcut: path: /doc controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController defaults: route: 'doc_page' legacy_doc: path: /legacy/doc controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController defaults: path: 'https://legacy.example.com/doc' ``` See more before/after configs (XML, PHP) in doc PR symfony/symfony-docs#12189 Commits ------- 0ebb469 Improving redirect config when using RedirectController
…en using RedirectController (yceruto) This PR was merged into the 4.4 branch. Discussion ---------- [FrameworkBundle][DX] Improving the redirect config when using RedirectController | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | symfony/symfony-docs#12189 follow-up symfony/symfony#24637 **Before:** ```yaml # config/routes.yaml doc_shortcut: path: /doc controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController::redirectAction defaults: route: 'doc_page' legacy_doc: path: /legacy/doc controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController::urlRedirectAction defaults: path: 'https://legacy.example.com/doc' ``` **After:** ```yaml # config/routes.yaml doc_shortcut: path: /doc controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController defaults: route: 'doc_page' legacy_doc: path: /legacy/doc controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController defaults: path: 'https://legacy.example.com/doc' ``` See more before/after configs (XML, PHP) in doc PR symfony/symfony-docs#12189 Commits ------- 0ebb469 Improving redirect config when using RedirectController
Tiny DX improvement when using modern Symfony.
Allow to write:
Instead of:
I was thinking about doing the same for
RedirectController
, but it's not that easy because it contains two methods.