Task #2126
Implement sub routes support (routes should be configured globally in one place)
100%
Description
Currently every package can define it's own routes which might cause an unmanageable configuration and leads to the problem that the loading order of the packages matter.
TODO:
move all existing route definitions to the global Routes.yml filemake sure, that FLOW3 ConfigurationManager only loads global Routesallow Packages to suggest Routes or to add Sub Routes (probably not in this release)
Related issues
Updated by Bastian Waidelich about 12 years ago
Additionally Routes should not be configured with a named index to avoid unintended overwriting of routes:
MyRoute1: uriPattern: 'foo' defaults: @package: MyPackage1 MyRoute2: uriPattern: 'bar' defaults: @package: MyPackage2 # this disables previously defined MyRoute1: MyRoute1: uriPattern: 'baz' defaults: @package: MyPackage3
Instead it should be
- uriPattern: 'foo' defaults: @package: MyPackage1 - uriPattern: 'bar' defaults: @package: MyPackage2 - uriPattern: 'baz' defaults: @package: MyPackage3
For debugging, it will be possible to identify the YAML file and filenumber of a Route's configuration. This relates to #2322
Updated by Karsten Dambekalns almost 12 years ago
Bastian and I talked about routing for some hours last Friday (Feb 27th). We had this idea to solve this (Bastian, if I miss something, feel free to fill in):
- Packages can define "Sub"-Routes in their Routes.yaml
- TYPO3 by default only reads Routes.yaml from the global configuration space (and context, of course)
- "Sub"-Routes can be imported/mounted under a prefix in the global configuration
- the later could also be done through some tool, preferably the package manager, which could also alert the user of existing "sub"-routes (or presets as you might call them)
- a routing setup tool will allow for display and simulated matching of URIs against the configuration to ease debugging and setup
The syntax with which the "sub"-routes will be like this:
---- YAML ---- uriPattern: tools/{TYPO3CR}' routeParts: TYPO3CR: subRoutes: package: TYPO3CR uriPattern: tools/{backupThingie}' routeParts: backupThingie: subRoutes: package: SiteBackup file: OptimizedRoutes.yaml ---- YAML ----
This means that "sub"-routes can be "mounted" with any prefix and will be configured like a route part. If only 'package' is given, Routes.yaml will be used, if 'file' is given a specific set of rules can be imported (this can be given multiple times to allow for modular rulesets, they are then combined).
'file' can not hold a path and is always relative to the package's 'Configuration' directory.
Notes:- the naming of the "sub"-routes needs to be finalized :)
- if you have ideas to share, shoot!
Updated by Robert Lemke over 11 years ago
- Subject changed from Routes should be configured globally in one place to Implement sub routes support (routes should be configured globally in one place)
- Priority changed from Should have to Must have
Updated by Bastian Waidelich over 11 years ago
- Status changed from Accepted to Resolved
- % Done changed from 0 to 100
Applied in changeset r2381.
Updated by Bastian Waidelich over 11 years ago
The syntax for subRoutes is (as in r2381):
-- uriPattern: foo/<mySubRoutes>/{bar} defaults: {bar}: someDefault subRoutes: mySubRoutes: package: MyPackage