Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
Commitee6bbb2
committed
feature#41414 Support
This PR was merged into the 5.4 branch.Discussion----------Support `statusCode` default param when loading template directly via route_This is my first PR to Symfony, so please be patient as I get to grips with the 'admin' process of getting everything exactly how you want it!_| Q | A| ------------- | ---| Branch? | 5.4| Bug fix? | no| New feature? | yes| Deprecations? | no| Tickets || License | MIT| Doc PR |symfony/symfony-docs#15376### TODO- [x] submit changes to the documentation and update this PR with a link### SummaryAdded support for `statusCode` default parameter when loading a template directly from route via the `Symfony\Bundle\FrameworkBundle\Controller\TemplateController` controller (like [this](https://symfony.com/doc/current/templates.html#templates-render-from-route)). This will continue to default to a 200 code, but can be changed by updating your route - for instance something like this:```test_route: path: /test_route controller: Symfony\Bundle\FrameworkBundle\Controller\TemplateController defaults: # the path of the template to render template: 'test.html.twig' # the status code to include in the response headers statusCode: 201```This could be useful for when you want to render a template without adding any extra business logic in a controller, but don't want to return a 200 response.Commits-------5a7b666 Added support for `statusCode` default parameter when loading a template directly from route using the `Symfony\Bundle\FrameworkBundle\Controller\TemplateController` controller.statusCode default param when loading template directly via route (dayallnash)File tree
3 files changed
+26
-9
lines changed- src/Symfony/Bundle/FrameworkBundle
- Controller
- Tests/Controller
3 files changed
+26
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
Lines changed: 10 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
41 | 42 | | |
42 | | - | |
| 43 | + | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
48 | | - | |
| 49 | + | |
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| |||
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
67 | | - | |
| 68 | + | |
68 | 69 | | |
69 | | - | |
| 70 | + | |
70 | 71 | | |
71 | 72 | | |
Lines changed: 15 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
62 | 77 | | |
0 commit comments
Comments
(0)