Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork5.2k
Commit7cfdbfc
committed
feature#14230 [Routing] Document the Route attribute (derrabus)
This PR was squashed before being merged into the 5.x branch.Discussion----------[Routing] Document the Route attributeThis PR documents the new `#[Route]` attribute that was introduced withsymfony/symfony#37474 and thuscloses#14188.For the routing configuration via Doctrine Annotations as well as PHP attributes, we use the very same class, `Symfony\Component\Routing\Annotation\Route`. This means that both mechanisms are equally powerful. Right now, there's nothing you can do with `@Route` that is impossible with `#[Route]` and vice versa. The main difference is that you don't need an external library for attributes because they're a native language feature.Because of that, I'd like to shift the general recommendation to use annotation towards attributes and recommend annotations as the fallback for projects that need to remain compatible with PHP 7.Right now, the `@Route` annotation is used throughout the documentation in two different ways:1. Demonstrate how to use the annotationIn this case, I've added an additional code block that shows the same configuration for attributes. I've consistently placed the attribute block before the annotation block.2. Give context about the route configuration.When a code block illustrates the logic inside a controller action and the annotation is only used to provide context, I think it would create too much noise to show the attribute _and_ the annotation way. In `routing.rst`, I have replaced the annotation with an equal attribute in such cases. I think it would be a good idea to do the same with the rest of the documentation, but I'd like to discuss this with you before I change all those spots.Commits-------4ca794e [Routing] Document the Route attributeFile tree
4 files changed
+446
-50
lines changed- _build
- contributing/documentation
4 files changed
+446
-50
lines changedLines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
111 | 111 |
| |
112 | 112 |
| |
113 | 113 |
| |
| 114 | + | |
114 | 115 |
| |
115 | 116 |
| |
116 | 117 |
| |
|
Lines changed: 6 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
223 | 223 |
| |
224 | 224 |
| |
225 | 225 |
| |
226 |
| - | |
227 |
| - | |
| 226 | + | |
| 227 | + | |
228 | 228 |
| |
229 |
| - | |
230 |
| - | |
231 |
| - | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
232 | 233 |
| |
233 | 234 |
| |
234 | 235 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
104 | 104 |
| |
105 | 105 |
| |
106 | 106 |
| |
| 107 | + | |
107 | 108 |
| |
108 | 109 |
| |
109 | 110 |
| |
|
0 commit comments
Comments
(0)