Feature #1790

Routing: optional RouteParts

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

Status:
Resolved
Priority:
Must have
Category:
MVC
Start date:
2008-10-23
Due date:
% Done:

100%

Estimated time:
PHP Version:
Has patch:
Complexity:

Description

We were thinking about a possibility to mark parts of the uriPattern optional. This could look something like:

$c->TYPO3Route_ServiceWithControllerAndFormat
    ->setUrlPattern('typo3/service/v1/[@controller].[@format](?orderby=[orderby])')
    ->setControllerComponentNamePattern('F3::@package::Service::Controller::@controllerController')
    ->setViewComponentNamePattern('F3::@package::Service::View::@controller::@action@format')
    ->setDefaults(
        array(
            '@package' => 'TYPO3',
            'orderby' => 'id'
        )
    );

the query part would be optional in this example. This would help to drastically reduce the amount of routes. You could do something like this too:

$c->myRoute
    ->setUrlPattern('typo3/service/v1/[@controller](.[@format])')
    ...

to mark the format suffix optional.

We'll have to resolve some logical challenges though.
E.g. we'll have to dissallow routes like this one:

$c->impossibleRoute
    ->setUrlPattern('static/[dynamic1](optional)[dynamic2]')
    ...

because the routing mechanismn could not tell where [dynamic1] ends.

#1

Updated by Karsten Dambekalns almost 13 years ago

  • Target version deleted (1.0 alpha 1)
#2

Updated by Karsten Dambekalns almost 13 years ago

  • Priority changed from Should have to Must have
  • Target version set to 1.0 alpha 1
#3

Updated by Bastian Waidelich over 12 years ago

  • % Done changed from 0 to 90
#4

Updated by Bastian Waidelich over 12 years ago

  • Status changed from New to Resolved
  • % Done changed from 90 to 100

Applied in changeset r1921.

Also available in: Atom PDF