Hi Xander,

Matus is correct, routes are examined in LIFO order by default, unless you
specify an explicit priority. This is important to remember when adding
routes in modules, as the order the modules are loaded in your Application
could affect your routing setup.

Cheers,

Michael Gooden


On 28 May 2013 03:44, Matus Zeman <[email protected]> wrote:

> Have you tried adding 'create' route after 'profile' one?
>
> Matus
>
>
> On 28 May 2013 08:41, Xander Guzman <[email protected]> wrote:
>
> > I have the following route defined
> >
> >                     'campaigns' => array(
> >                         'type'    => 'Zend\Mvc\Router\Http\Literal',
> >                         'options' => array(
> >                             'route'    => 'campaigns',
> >                             'defaults' => array(
> >                                 'controller' =>
> > 'Application\Controller\Campaigns',
> >                                 'action'     => 'index',
> >                             ),
> >                         ),
> >                         'may_terminate' => true,
> >                         'child_routes' => array(
> >                             'create' => array(
> >                                 'type'  =>
> 'Zend\Mvc\Router\Http\Literal',
> >                                 'options' => array(
> >                                     'route'  => '/create',
> >                                     'action' => 'create',
> >                                 ),
> >                             ),
> >                             'profile' => array(
> >                                 'type'    =>
> > 'Zend\Mvc\Router\Http\Segment',
> >                                 'options' => array(
> >                                     'route'    => '/:campaign-slug',
> >                                     'defaults' => array(
> >                                         'action' => 'campaign',
> >                                     ),
> >                                 ),
> >                                 'may_terminate' => true,
> >                                 'child_routes' => array()
> >                         ),
> >
> > My problem is the way I'm understanding it if I type in /campaigns/create
> > it should map to /create and if I enter anything else
> > /campaigns/foofoobunny that should match the /:campaign-slug route.
> Problem
> > is that it doesn't work, why is this? How could I make it so if I define
> an
> > explicit route it will match and if it doesn't it falls back to this
> > default dynamic route?
> >
>

Reply via email to