Re: [fw-general] [zf2] Help me understand routing

2013-05-31 Thread Xander Guzman
Thank you both! I'll try that and report.


On Tue, May 28, 2013 at 1:12 AM, Michael Gooden wrote:

> 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  wrote:
>
>> Have you tried adding 'create' route after 'profile' one?
>>
>> Matus
>>
>>
>> On 28 May 2013 08:41, Xander Guzman  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?
>> >
>>
>
>


Re: [fw-general] [zf2] Help me understand routing

2013-05-28 Thread Michael Gooden
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  wrote:

> Have you tried adding 'create' route after 'profile' one?
>
> Matus
>
>
> On 28 May 2013 08:41, Xander Guzman  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?
> >
>


Re: [fw-general] [zf2] Help me understand routing

2013-05-27 Thread Matus Zeman
Have you tried adding 'create' route after 'profile' one?

Matus


On 28 May 2013 08:41, Xander Guzman  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?
>


[fw-general] [zf2] Help me understand routing

2013-05-27 Thread Xander Guzman
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?