Chris@0: CHANGELOG
Chris@0: =========
Chris@0:
Chris@14: 3.4.0
Chris@14: -----
Chris@14:
Chris@14: * Added `NoConfigurationException`.
Chris@14: * Added the possibility to define a prefix for all routes of a controller via @Route(name="prefix_")
Chris@14: * Added support for prioritized routing loaders.
Chris@14: * Add matched and default parameters to redirect responses
Chris@14: * Added support for a `controller` keyword for configuring route controllers in YAML and XML configurations.
Chris@14:
Chris@14: 3.3.0
Chris@14: -----
Chris@14:
Chris@14: * [DEPRECATION] Class parameters have been deprecated and will be removed in 4.0.
Chris@14: * router.options.generator_class
Chris@14: * router.options.generator_base_class
Chris@14: * router.options.generator_dumper_class
Chris@14: * router.options.matcher_class
Chris@14: * router.options.matcher_base_class
Chris@14: * router.options.matcher_dumper_class
Chris@14: * router.options.matcher.cache_class
Chris@14: * router.options.generator.cache_class
Chris@14:
Chris@0: 3.2.0
Chris@0: -----
Chris@0:
Chris@0: * Added support for `bool`, `int`, `float`, `string`, `list` and `map` defaults in XML configurations.
Chris@0: * Added support for UTF-8 requirements
Chris@14:
Chris@0: 2.8.0
Chris@0: -----
Chris@0:
Chris@0: * allowed specifying a directory to recursively load all routing configuration files it contains
Chris@0: * Added ObjectRouteLoader and ServiceRouteLoader that allow routes to be loaded
Chris@0: by calling a method on an object/service.
Chris@0: * [DEPRECATION] Deprecated the hardcoded value for the `$referenceType` argument of the `UrlGeneratorInterface::generate` method.
Chris@0: Use the constants defined in the `UrlGeneratorInterface` instead.
Chris@0:
Chris@0: Before:
Chris@0:
Chris@0: ```php
Chris@17: $router->generate('blog_show', ['slug' => 'my-blog-post'], true);
Chris@0: ```
Chris@0:
Chris@0: After:
Chris@0:
Chris@0: ```php
Chris@0: use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
Chris@0:
Chris@17: $router->generate('blog_show', ['slug' => 'my-blog-post'], UrlGeneratorInterface::ABSOLUTE_URL);
Chris@0: ```
Chris@0:
Chris@0: 2.5.0
Chris@0: -----
Chris@0:
Chris@0: * [DEPRECATION] The `ApacheMatcherDumper` and `ApacheUrlMatcher` were deprecated and
Chris@0: will be removed in Symfony 3.0, since the performance gains were minimal and
Chris@18: it's hard to replicate the behavior of PHP implementation.
Chris@0:
Chris@0: 2.3.0
Chris@0: -----
Chris@0:
Chris@0: * added RequestContext::getQueryString()
Chris@0:
Chris@0: 2.2.0
Chris@0: -----
Chris@0:
Chris@0: * [DEPRECATION] Several route settings have been renamed (the old ones will be removed in 3.0):
Chris@0:
Chris@0: * The `pattern` setting for a route has been deprecated in favor of `path`
Chris@0: * The `_scheme` and `_method` requirements have been moved to the `schemes` and `methods` settings
Chris@0:
Chris@0: Before:
Chris@0:
Chris@0: ```yaml
Chris@0: article_edit:
Chris@0: pattern: /article/{id}
Chris@0: requirements: { '_method': 'POST|PUT', '_scheme': 'https', 'id': '\d+' }
Chris@0: ```
Chris@0:
Chris@0: ```xml
Chris@0:
Chris@0: POST|PUT
Chris@0: https
Chris@0: \d+
Chris@0:
Chris@0: ```
Chris@0:
Chris@0: ```php
Chris@0: $route = new Route();
Chris@0: $route->setPattern('/article/{id}');
Chris@0: $route->setRequirement('_method', 'POST|PUT');
Chris@0: $route->setRequirement('_scheme', 'https');
Chris@0: ```
Chris@0:
Chris@0: After:
Chris@0:
Chris@0: ```yaml
Chris@0: article_edit:
Chris@0: path: /article/{id}
Chris@0: methods: [POST, PUT]
Chris@0: schemes: https
Chris@0: requirements: { 'id': '\d+' }
Chris@0: ```
Chris@0:
Chris@0: ```xml
Chris@0:
Chris@0: \d+
Chris@0:
Chris@0: ```
Chris@0:
Chris@0: ```php
Chris@0: $route = new Route();
Chris@0: $route->setPath('/article/{id}');
Chris@17: $route->setMethods(['POST', 'PUT']);
Chris@0: $route->setSchemes('https');
Chris@0: ```
Chris@0:
Chris@0: * [BC BREAK] RouteCollection does not behave like a tree structure anymore but as
Chris@0: a flat array of Routes. So when using PHP to build the RouteCollection, you must
Chris@0: make sure to add routes to the sub-collection before adding it to the parent
Chris@0: collection (this is not relevant when using YAML or XML for Route definitions).
Chris@0:
Chris@0: Before:
Chris@0:
Chris@0: ```php
Chris@0: $rootCollection = new RouteCollection();
Chris@0: $subCollection = new RouteCollection();
Chris@0: $rootCollection->addCollection($subCollection);
Chris@0: $subCollection->add('foo', new Route('/foo'));
Chris@0: ```
Chris@0:
Chris@0: After:
Chris@0:
Chris@0: ```php
Chris@0: $rootCollection = new RouteCollection();
Chris@0: $subCollection = new RouteCollection();
Chris@0: $subCollection->add('foo', new Route('/foo'));
Chris@0: $rootCollection->addCollection($subCollection);
Chris@0: ```
Chris@0:
Chris@0: Also one must call `addCollection` from the bottom to the top hierarchy.
Chris@0: So the correct sequence is the following (and not the reverse):
Chris@0:
Chris@0: ```php
Chris@0: $childCollection->addCollection($grandchildCollection);
Chris@0: $rootCollection->addCollection($childCollection);
Chris@0: ```
Chris@0:
Chris@0: * [DEPRECATION] The methods `RouteCollection::getParent()` and `RouteCollection::getRoot()`
Chris@0: have been deprecated and will be removed in Symfony 2.3.
Chris@0: * [BC BREAK] Misusing the `RouteCollection::addPrefix` method to add defaults, requirements
Chris@0: or options without adding a prefix is not supported anymore. So if you called `addPrefix`
Chris@0: with an empty prefix or `/` only (both have no relevance), like
Chris@0: `addPrefix('', $defaultsArray, $requirementsArray, $optionsArray)`
Chris@0: you need to use the new dedicated methods `addDefaults($defaultsArray)`,
Chris@0: `addRequirements($requirementsArray)` or `addOptions($optionsArray)` instead.
Chris@0: * [DEPRECATION] The `$options` parameter to `RouteCollection::addPrefix()` has been deprecated
Chris@0: because adding options has nothing to do with adding a path prefix. If you want to add options
Chris@0: to all child routes of a RouteCollection, you can use `addOptions()`.
Chris@0: * [DEPRECATION] The method `RouteCollection::getPrefix()` has been deprecated
Chris@0: because it suggested that all routes in the collection would have this prefix, which is
Chris@0: not necessarily true. On top of that, since there is no tree structure anymore, this method
Chris@0: is also useless. Don't worry about performance, prefix optimization for matching is still done
Chris@0: in the dumper, which was also improved in 2.2.0 to find even more grouping possibilities.
Chris@0: * [DEPRECATION] `RouteCollection::addCollection(RouteCollection $collection)` should now only be
Chris@0: used with a single parameter. The other params `$prefix`, `$default`, `$requirements` and `$options`
Chris@0: will still work, but have been deprecated. The `addPrefix` method should be used for this
Chris@0: use-case instead.
Chris@17: Before: `$parentCollection->addCollection($collection, '/prefix', [...], [...])`
Chris@0: After:
Chris@0: ```php
Chris@17: $collection->addPrefix('/prefix', [...], [...]);
Chris@0: $parentCollection->addCollection($collection);
Chris@0: ```
Chris@0: * added support for the method default argument values when defining a @Route
Chris@0: * Adjacent placeholders without separator work now, e.g. `/{x}{y}{z}.{_format}`.
Chris@0: * Characters that function as separator between placeholders are now whitelisted
Chris@0: to fix routes with normal text around a variable, e.g. `/prefix{var}suffix`.
Chris@0: * [BC BREAK] The default requirement of a variable has been changed slightly.
Chris@0: Previously it disallowed the previous and the next char around a variable. Now
Chris@0: it disallows the slash (`/`) and the next char. Using the previous char added
Chris@0: no value and was problematic because the route `/index.{_format}` would be
Chris@0: matched by `/index.ht/ml`.
Chris@0: * The default requirement now uses possessive quantifiers when possible which
Chris@0: improves matching performance by up to 20% because it prevents backtracking
Chris@0: when it's not needed.
Chris@0: * The ConfigurableRequirementsInterface can now also be used to disable the requirements
Chris@0: check on URL generation completely by calling `setStrictRequirements(null)`. It
Chris@0: improves performance in production environment as you should know that params always
Chris@0: pass the requirements (otherwise it would break your link anyway).
Chris@0: * There is no restriction on the route name anymore. So non-alphanumeric characters
Chris@0: are now also allowed.
Chris@0: * [BC BREAK] `RouteCompilerInterface::compile(Route $route)` was made static
Chris@0: (only relevant if you implemented your own RouteCompiler).
Chris@0: * Added possibility to generate relative paths and network paths in the UrlGenerator, e.g.
Chris@0: "../parent-file" and "//example.com/dir/file". The third parameter in
Chris@17: `UrlGeneratorInterface::generate($name, $parameters = [], $referenceType = self::ABSOLUTE_PATH)`
Chris@0: now accepts more values and you should use the constants defined in `UrlGeneratorInterface` for
Chris@0: claritiy. The old method calls with a Boolean parameter will continue to work because they
Chris@0: equal the signature using the constants.
Chris@0:
Chris@0: 2.1.0
Chris@0: -----
Chris@0:
Chris@0: * added RequestMatcherInterface
Chris@0: * added RequestContext::fromRequest()
Chris@0: * the UrlMatcher does not throw a \LogicException anymore when the required
Chris@0: scheme is not the current one
Chris@0: * added TraceableUrlMatcher
Chris@0: * added the possibility to define options, default values and requirements
Chris@0: for placeholders in prefix, including imported routes
Chris@0: * added RouterInterface::getRouteCollection
Chris@0: * [BC BREAK] the UrlMatcher urldecodes the route parameters only once, they
Chris@0: were decoded twice before. Note that the `urldecode()` calls have been
Chris@0: changed for a single `rawurldecode()` in order to support `+` for input
Chris@0: paths.
Chris@0: * added RouteCollection::getRoot method to retrieve the root of a
Chris@0: RouteCollection tree
Chris@0: * [BC BREAK] made RouteCollection::setParent private which could not have
Chris@0: been used anyway without creating inconsistencies
Chris@0: * [BC BREAK] RouteCollection::remove also removes a route from parent
Chris@0: collections (not only from its children)
Chris@0: * added ConfigurableRequirementsInterface that allows to disable exceptions
Chris@0: (and generate empty URLs instead) when generating a route with an invalid
Chris@0: parameter value