Task #2126

Implement sub routes support (routes should be configured globally in one place)

Added by Bastian Waidelich almost 13 years ago. Updated almost 11 years ago.

Status:
Resolved
Priority:
Must have
Category:
Configuration
Start date:
2008-11-11
Due date:
% Done:

100%

Estimated time:
Sprint:
PHP Version:
Has patch:
Complexity:

Description

Routes should be configured globally at one place to avoid complexity and make it possible to disable/change existing routes in new distributions.
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 file
  • make sure, that FLOW3 ConfigurationManager only loads global Routes
  • allow Packages to suggest Routes or to add Sub Routes (probably not in this release)

Related issues

Related to YAML - Feature #2322: Possibility to track filename and line number of a specific configuration settingNewRobert Lemke2008-12-15

Actions
Related to TYPO3.Flow - Bug #3433: Routes in packages are overruled by global configurationResolvedRobert Lemke2009-05-24

Actions
#1

Updated by Bastian Waidelich almost 13 years ago

  • Assignee set to Bastian Waidelich
#2

Updated by Bastian Waidelich almost 13 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

#3

Updated by Karsten Dambekalns over 12 years ago

  • Status changed from New to Accepted
#4

Updated by Karsten Dambekalns over 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!
#5

Updated by Robert Lemke over 12 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
#6

Updated by Bastian Waidelich over 12 years ago

  • Status changed from Accepted to Resolved
  • % Done changed from 0 to 100

Applied in changeset r2381.

#7

Updated by Bastian Waidelich over 12 years ago

The syntax for subRoutes is (as in r2381):

--
  uriPattern: foo/<mySubRoutes>/{bar}
  defaults:
    {bar}: someDefault
  subRoutes:
    mySubRoutes:
      package: MyPackage

Also available in: Atom PDF