Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

@dunglas
Copy link
Member

@dunglasdunglas commentedOct 19, 2017
edited
Loading

QA
Branch?3.4
Bug fix?no
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed ticketsn/a
LicenseMIT
Doc PRsymfony/symfony-docs#10320

Tiny DX improvement when using modern Symfony.

Allow to write:

# config/routes.yamlindex:path:/defaults:_controller:'Symfony\Bundle\FrameworkBundle\Controller\TemplateController'template:'homepage.html.twig'

Instead of:

index:path:/defaults:_controller:'Symfony\Bundle\FrameworkBundle\Controller\TemplateController::templateAction'template:'homepage.html.twig'

I was thinking about doing the same forRedirectController, but it's not that easy because it contains two methods.

yceruto, theofidry, TomasVotruba, dmaicher, derrabus, vudaltsov, and apfelbox reacted with thumbs up emoji
@chalasrchalasr added this to the3.4 milestoneOct 19, 2017
@fabpot
Copy link
Member

Moving to 4.1. 3.4 is closed for new features.

@fabpotfabpot modified the milestones:3.4,4.1Oct 20, 2017
@derrabus
Copy link
Member

@dunglas Inside aRedirectController::__invoke(), you could check if either the attributeroute orpath has been set on the request and call the corresponding action.

dunglas reacted with hooray emoji

return$response;
}

publicfunction__invoke($template,$maxAge =null,$sharedAge =null,$private =null)
Copy link
Member

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

chalasr, derrabus, and dunglas reacted with thumbs up emoji
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

done

@dunglasdunglas changed the base branch from3.4 tomasterDecember 1, 2017 18:48
@dunglasdunglasforce-pushed theinvokable-template-controller branch 2 times, most recently fromdbbf3c1 toc14786bCompareDecember 1, 2017 18:55
@dunglasdunglasforce-pushed theinvokable-template-controller branch fromc14786b to6d15055CompareDecember 1, 2017 18:56
@dunglas
Copy link
MemberAuthor

Failure not related

@Tobion
Copy link
Contributor

Thank you@dunglas.

@TobionTobion merged commit6d15055 intosymfony:masterDec 4, 2017
Tobion added a commit that referenced this pull requestDec 4, 2017
… 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/aTiny DX improvement when using modern Symfony.Allow to write:```yaml# config/routes.yamlindex:    path: /    defaults:      _controller: 'Symfony\Bundle\FrameworkBundle\Controller\TemplateController'      template: 'homepage.html.twig'```Instead of:```yamlindex:    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
fabpot added a commit that referenced this pull requestJan 19, 2018
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 :)```yamlSome\Foo:    tags: [{ name: kernel.event_listener, event: kernel.request }]``````phpclass Foo {    public function __invoke(GetResponseEvent $event) { }}```Commits-------fa5b7eb [DI] Allow for invokable event listeners
@fabpotfabpot mentioned this pull requestMay 7, 2018
@dunglasdunglas deleted the invokable-template-controller branchSeptember 10, 2018 20:41
javiereguiluz added a commit to symfony/symfony-docs that referenced this pull requestSep 11, 2018
…dunglas)This PR was merged into the 4.1 branch.Discussion----------[FrameworkBundle] Improve the DX of TemplateControllersymfony/symfony#24637Commits-------fca1a5b [FrameworkBundle] Improve the DX of TemplateController
yceruto added a commit that referenced this pull requestAug 23, 2019
…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#12189follow-up#24637**Before:**```yaml# config/routes.yamldoc_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.yamldoc_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 PRsymfony/symfony-docs#12189Commits-------0ebb469 Improving redirect config when using RedirectController
symfony-splitter pushed a commit to symfony/framework-bundle that referenced this pull requestAug 23, 2019
…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#12189follow-upsymfony/symfony#24637**Before:**```yaml# config/routes.yamldoc_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.yamldoc_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 PRsymfony/symfony-docs#12189Commits-------0ebb469 Improving redirect config when using RedirectController
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@xabbuhxabbuhxabbuh left review comments

@fabpotfabpotfabpot approved these changes

@lyrixxlyrixxlyrixx approved these changes

@chalasrchalasrchalasr approved these changes

+3 more reviewers

@mickaelandrieumickaelandrieumickaelandrieu approved these changes

@ogizanagiogizanagiogizanagi approved these changes

@20uf20uf20uf approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

4.1

Development

Successfully merging this pull request may close these issues.

11 participants

@dunglas@fabpot@derrabus@Tobion@lyrixx@mickaelandrieu@xabbuh@ogizanagi@20uf@chalasr@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp