annotate vendor/symfony/routing/CHANGELOG.md @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children 1fec387a4317
rev   line source
Chris@0 1 CHANGELOG
Chris@0 2 =========
Chris@0 3
Chris@0 4 3.2.0
Chris@0 5 -----
Chris@0 6
Chris@0 7 * Added support for `bool`, `int`, `float`, `string`, `list` and `map` defaults in XML configurations.
Chris@0 8 * Added support for UTF-8 requirements
Chris@0 9
Chris@0 10 2.8.0
Chris@0 11 -----
Chris@0 12
Chris@0 13 * allowed specifying a directory to recursively load all routing configuration files it contains
Chris@0 14 * Added ObjectRouteLoader and ServiceRouteLoader that allow routes to be loaded
Chris@0 15 by calling a method on an object/service.
Chris@0 16 * [DEPRECATION] Deprecated the hardcoded value for the `$referenceType` argument of the `UrlGeneratorInterface::generate` method.
Chris@0 17 Use the constants defined in the `UrlGeneratorInterface` instead.
Chris@0 18
Chris@0 19 Before:
Chris@0 20
Chris@0 21 ```php
Chris@0 22 $router->generate('blog_show', array('slug' => 'my-blog-post'), true);
Chris@0 23 ```
Chris@0 24
Chris@0 25 After:
Chris@0 26
Chris@0 27 ```php
Chris@0 28 use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
Chris@0 29
Chris@0 30 $router->generate('blog_show', array('slug' => 'my-blog-post'), UrlGeneratorInterface::ABSOLUTE_URL);
Chris@0 31 ```
Chris@0 32
Chris@0 33 2.5.0
Chris@0 34 -----
Chris@0 35
Chris@0 36 * [DEPRECATION] The `ApacheMatcherDumper` and `ApacheUrlMatcher` were deprecated and
Chris@0 37 will be removed in Symfony 3.0, since the performance gains were minimal and
Chris@0 38 it's hard to replicate the behaviour of PHP implementation.
Chris@0 39
Chris@0 40 2.3.0
Chris@0 41 -----
Chris@0 42
Chris@0 43 * added RequestContext::getQueryString()
Chris@0 44
Chris@0 45 2.2.0
Chris@0 46 -----
Chris@0 47
Chris@0 48 * [DEPRECATION] Several route settings have been renamed (the old ones will be removed in 3.0):
Chris@0 49
Chris@0 50 * The `pattern` setting for a route has been deprecated in favor of `path`
Chris@0 51 * The `_scheme` and `_method` requirements have been moved to the `schemes` and `methods` settings
Chris@0 52
Chris@0 53 Before:
Chris@0 54
Chris@0 55 ```yaml
Chris@0 56 article_edit:
Chris@0 57 pattern: /article/{id}
Chris@0 58 requirements: { '_method': 'POST|PUT', '_scheme': 'https', 'id': '\d+' }
Chris@0 59 ```
Chris@0 60
Chris@0 61 ```xml
Chris@0 62 <route id="article_edit" pattern="/article/{id}">
Chris@0 63 <requirement key="_method">POST|PUT</requirement>
Chris@0 64 <requirement key="_scheme">https</requirement>
Chris@0 65 <requirement key="id">\d+</requirement>
Chris@0 66 </route>
Chris@0 67 ```
Chris@0 68
Chris@0 69 ```php
Chris@0 70 $route = new Route();
Chris@0 71 $route->setPattern('/article/{id}');
Chris@0 72 $route->setRequirement('_method', 'POST|PUT');
Chris@0 73 $route->setRequirement('_scheme', 'https');
Chris@0 74 ```
Chris@0 75
Chris@0 76 After:
Chris@0 77
Chris@0 78 ```yaml
Chris@0 79 article_edit:
Chris@0 80 path: /article/{id}
Chris@0 81 methods: [POST, PUT]
Chris@0 82 schemes: https
Chris@0 83 requirements: { 'id': '\d+' }
Chris@0 84 ```
Chris@0 85
Chris@0 86 ```xml
Chris@0 87 <route id="article_edit" pattern="/article/{id}" methods="POST PUT" schemes="https">
Chris@0 88 <requirement key="id">\d+</requirement>
Chris@0 89 </route>
Chris@0 90 ```
Chris@0 91
Chris@0 92 ```php
Chris@0 93 $route = new Route();
Chris@0 94 $route->setPath('/article/{id}');
Chris@0 95 $route->setMethods(array('POST', 'PUT'));
Chris@0 96 $route->setSchemes('https');
Chris@0 97 ```
Chris@0 98
Chris@0 99 * [BC BREAK] RouteCollection does not behave like a tree structure anymore but as
Chris@0 100 a flat array of Routes. So when using PHP to build the RouteCollection, you must
Chris@0 101 make sure to add routes to the sub-collection before adding it to the parent
Chris@0 102 collection (this is not relevant when using YAML or XML for Route definitions).
Chris@0 103
Chris@0 104 Before:
Chris@0 105
Chris@0 106 ```php
Chris@0 107 $rootCollection = new RouteCollection();
Chris@0 108 $subCollection = new RouteCollection();
Chris@0 109 $rootCollection->addCollection($subCollection);
Chris@0 110 $subCollection->add('foo', new Route('/foo'));
Chris@0 111 ```
Chris@0 112
Chris@0 113 After:
Chris@0 114
Chris@0 115 ```php
Chris@0 116 $rootCollection = new RouteCollection();
Chris@0 117 $subCollection = new RouteCollection();
Chris@0 118 $subCollection->add('foo', new Route('/foo'));
Chris@0 119 $rootCollection->addCollection($subCollection);
Chris@0 120 ```
Chris@0 121
Chris@0 122 Also one must call `addCollection` from the bottom to the top hierarchy.
Chris@0 123 So the correct sequence is the following (and not the reverse):
Chris@0 124
Chris@0 125 ```php
Chris@0 126 $childCollection->addCollection($grandchildCollection);
Chris@0 127 $rootCollection->addCollection($childCollection);
Chris@0 128 ```
Chris@0 129
Chris@0 130 * [DEPRECATION] The methods `RouteCollection::getParent()` and `RouteCollection::getRoot()`
Chris@0 131 have been deprecated and will be removed in Symfony 2.3.
Chris@0 132 * [BC BREAK] Misusing the `RouteCollection::addPrefix` method to add defaults, requirements
Chris@0 133 or options without adding a prefix is not supported anymore. So if you called `addPrefix`
Chris@0 134 with an empty prefix or `/` only (both have no relevance), like
Chris@0 135 `addPrefix('', $defaultsArray, $requirementsArray, $optionsArray)`
Chris@0 136 you need to use the new dedicated methods `addDefaults($defaultsArray)`,
Chris@0 137 `addRequirements($requirementsArray)` or `addOptions($optionsArray)` instead.
Chris@0 138 * [DEPRECATION] The `$options` parameter to `RouteCollection::addPrefix()` has been deprecated
Chris@0 139 because adding options has nothing to do with adding a path prefix. If you want to add options
Chris@0 140 to all child routes of a RouteCollection, you can use `addOptions()`.
Chris@0 141 * [DEPRECATION] The method `RouteCollection::getPrefix()` has been deprecated
Chris@0 142 because it suggested that all routes in the collection would have this prefix, which is
Chris@0 143 not necessarily true. On top of that, since there is no tree structure anymore, this method
Chris@0 144 is also useless. Don't worry about performance, prefix optimization for matching is still done
Chris@0 145 in the dumper, which was also improved in 2.2.0 to find even more grouping possibilities.
Chris@0 146 * [DEPRECATION] `RouteCollection::addCollection(RouteCollection $collection)` should now only be
Chris@0 147 used with a single parameter. The other params `$prefix`, `$default`, `$requirements` and `$options`
Chris@0 148 will still work, but have been deprecated. The `addPrefix` method should be used for this
Chris@0 149 use-case instead.
Chris@0 150 Before: `$parentCollection->addCollection($collection, '/prefix', array(...), array(...))`
Chris@0 151 After:
Chris@0 152 ```php
Chris@0 153 $collection->addPrefix('/prefix', array(...), array(...));
Chris@0 154 $parentCollection->addCollection($collection);
Chris@0 155 ```
Chris@0 156 * added support for the method default argument values when defining a @Route
Chris@0 157 * Adjacent placeholders without separator work now, e.g. `/{x}{y}{z}.{_format}`.
Chris@0 158 * Characters that function as separator between placeholders are now whitelisted
Chris@0 159 to fix routes with normal text around a variable, e.g. `/prefix{var}suffix`.
Chris@0 160 * [BC BREAK] The default requirement of a variable has been changed slightly.
Chris@0 161 Previously it disallowed the previous and the next char around a variable. Now
Chris@0 162 it disallows the slash (`/`) and the next char. Using the previous char added
Chris@0 163 no value and was problematic because the route `/index.{_format}` would be
Chris@0 164 matched by `/index.ht/ml`.
Chris@0 165 * The default requirement now uses possessive quantifiers when possible which
Chris@0 166 improves matching performance by up to 20% because it prevents backtracking
Chris@0 167 when it's not needed.
Chris@0 168 * The ConfigurableRequirementsInterface can now also be used to disable the requirements
Chris@0 169 check on URL generation completely by calling `setStrictRequirements(null)`. It
Chris@0 170 improves performance in production environment as you should know that params always
Chris@0 171 pass the requirements (otherwise it would break your link anyway).
Chris@0 172 * There is no restriction on the route name anymore. So non-alphanumeric characters
Chris@0 173 are now also allowed.
Chris@0 174 * [BC BREAK] `RouteCompilerInterface::compile(Route $route)` was made static
Chris@0 175 (only relevant if you implemented your own RouteCompiler).
Chris@0 176 * Added possibility to generate relative paths and network paths in the UrlGenerator, e.g.
Chris@0 177 "../parent-file" and "//example.com/dir/file". The third parameter in
Chris@0 178 `UrlGeneratorInterface::generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH)`
Chris@0 179 now accepts more values and you should use the constants defined in `UrlGeneratorInterface` for
Chris@0 180 claritiy. The old method calls with a Boolean parameter will continue to work because they
Chris@0 181 equal the signature using the constants.
Chris@0 182
Chris@0 183 2.1.0
Chris@0 184 -----
Chris@0 185
Chris@0 186 * added RequestMatcherInterface
Chris@0 187 * added RequestContext::fromRequest()
Chris@0 188 * the UrlMatcher does not throw a \LogicException anymore when the required
Chris@0 189 scheme is not the current one
Chris@0 190 * added TraceableUrlMatcher
Chris@0 191 * added the possibility to define options, default values and requirements
Chris@0 192 for placeholders in prefix, including imported routes
Chris@0 193 * added RouterInterface::getRouteCollection
Chris@0 194 * [BC BREAK] the UrlMatcher urldecodes the route parameters only once, they
Chris@0 195 were decoded twice before. Note that the `urldecode()` calls have been
Chris@0 196 changed for a single `rawurldecode()` in order to support `+` for input
Chris@0 197 paths.
Chris@0 198 * added RouteCollection::getRoot method to retrieve the root of a
Chris@0 199 RouteCollection tree
Chris@0 200 * [BC BREAK] made RouteCollection::setParent private which could not have
Chris@0 201 been used anyway without creating inconsistencies
Chris@0 202 * [BC BREAK] RouteCollection::remove also removes a route from parent
Chris@0 203 collections (not only from its children)
Chris@0 204 * added ConfigurableRequirementsInterface that allows to disable exceptions
Chris@0 205 (and generate empty URLs instead) when generating a route with an invalid
Chris@0 206 parameter value