Is it possible to alter a route object after it has been instantiated?

I'd like to be able to do something like this:

// for route: /example/:id

$clone = clone $router->getRoute( 'example' );
$clone->setRoute( '/example2/:id' );
$router->addRoute( 'example2', $clone );

Which would result in /example/:id and /example2/:id going to the same action using identical defaults and requirements.

Or just altering it after the fact without clone:

$router->getRoute( 'example' )->setRoute( '/example2/:id' )- >setDefault( ':id', 'some-other-id' );

The set methods don't exist on the existing route object and I know I could make my own route object to do this but is there an underlying technological reason they're not already there?

The reason I ask it that we have our existing router and routes set up but then part of our application will allow the administrators to change the default urls that point to various aspects of the site. If they want to call the "news" section "press" they we want the url to reflect "/press" rather than "/news".

- Jeffrey

Reply via email to