Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 51223c0

Browse files
committed
added upgrade instructions
1 parent 50e6259 commit 51223c0

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed

UPGRADE-2.2.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,42 @@
3636

3737
* The PasswordType is now not trimmed by default.
3838

39+
### Routing
40+
41+
* RouteCollection does not behave like a tree structure anymore but as a flat
42+
array of Routes. So when using PHP to build the RouteCollection, you must
43+
make sure to add routes to the sub-collection before adding it to the parent
44+
collection (this is not relevant when using YAML or XML for Route definitions).
45+
46+
Before:
47+
48+
```
49+
$rootCollection = new RouteCollection();
50+
$subCollection = new RouteCollection();
51+
$rootCollection->addCollection($subCollection);
52+
$subCollection->add('foo', new Route('/foo'));
53+
```
54+
55+
After:
56+
57+
```
58+
$rootCollection = new RouteCollection();
59+
$subCollection = new RouteCollection();
60+
$subCollection->add('foo', new Route('/foo'));
61+
$rootCollection->addCollection($subCollection);
62+
```
63+
64+
Also one must call `addCollection` from the bottom to the top hierarchy.
65+
So the correct sequence is the following (and not the reverse):
66+
67+
```
68+
$childCollection->->addCollection($grandchildCollection);
69+
$rootCollection->addCollection($childCollection);
70+
```
71+
72+
* The methods `RouteCollection::getParent()` and `RouteCollection::getRoot()`
73+
have been deprecated and will be removed in Symfony 2.3.
74+
3975
### Validator
4076

4177
* Interfaces were created for created for the classes `ConstraintViolation`,

src/Symfony/Component/Routing/CHANGELOG.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,39 @@ CHANGELOG
44
2.2.0
55
-----
66

7+
* [BC BREAK] RouteCollection does not behave like a tree structure anymore but as
8+
a flat array of Routes. So when using PHP to build the RouteCollection, you must
9+
make sure to add routes to the sub-collection before adding it to the parent
10+
collection (this is not relevant when using YAML or XML for Route definitions).
11+
12+
Before:
13+
14+
```
15+
$rootCollection = new RouteCollection();
16+
$subCollection = new RouteCollection();
17+
$rootCollection->addCollection($subCollection);
18+
$subCollection->add('foo', new Route('/foo'));
19+
```
20+
21+
After:
22+
23+
```
24+
$rootCollection = new RouteCollection();
25+
$subCollection = new RouteCollection();
26+
$subCollection->add('foo', new Route('/foo'));
27+
$rootCollection->addCollection($subCollection);
28+
```
29+
30+
Also one must call `addCollection` from the bottom to the top hierarchy.
31+
So the correct sequence is the following (and not the reverse):
32+
33+
```
34+
$childCollection->->addCollection($grandchildCollection);
35+
$rootCollection->addCollection($childCollection);
36+
```
37+
38+
* The methods `RouteCollection::getParent()` and `RouteCollection::getRoot()`
39+
have been deprecated and will be removed in Symfony 2.3.
740
* added support for the method default argument values when defining a @Route
841
* Adjacent placeholders without separator work now, e.g. `/{x}{y}{z}.{_format}`.
942
* Characters that function as separator between placeholders are now whitelisted

0 commit comments

Comments
 (0)