Router::match skip persistent parameters #665

tefra opened this Issue Oct 13, 2012 · 4 comments


None yet
4 participants

tefra commented Oct 13, 2012

It would be great if you could skip all persistent parameters all together instead of trying to set one by one as null, something like a reset flag you could pass in the options list which would pass to the router _prepareParams method,


nateabele commented Oct 19, 2012

What would be the use case for this?


tefra commented Oct 19, 2012

Resolve conflicts between different routes with their own persistent params.

Administrator panel with it's route

            array('admin' => true, 'library' => 'core', 'controller' => 'dashboard', 'action' => 'index', 'id' => null),
            array('persist' => array('admin', 'library', 'controller')));

And you want to link to something to the front-end, let's say a page route

            array('library' => 'pages', 'controller' => 'page', 'action' => 'view', 'slug' => null),
            array('persist' => array('library', 'controller')));

You would have to set the admin param to null to make it work and that's ok.

$this->url(array('library' => 'pages',  'controller' => 'page', 'action' => 'view', 'admin' => null, 'slug' => $item->slug))

But imagine having a system like a cms/cmf where you could install libraries from various sources, it's impossible to resolve all persistent parameters conflicts. Let's say you have a contact-us plugin and you want to display a link in the header of all pages, the url would have to be hard-written because you don't know what conflicts may come up. That's where the reset flag comes in handy.

$this->url(array('library' => 'contact',  'controller' => 'form', 'action' => 'view'), array('reset' => true));

d1rk commented Oct 19, 2012

i'd agree - i had that use-case several times and find it tiring to set all these parameters to null


nateabele commented Oct 19, 2012

Got it, thanks for the feedback, guys.

@davidpersson davidpersson added this to the 1.1 milestone Jun 3, 2016

@davidpersson davidpersson modified the milestones: 1.2, 1.1 May 3, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment