Kohana: why won't this route generate fully?
I have the following route in my bootstrap:
Route::set('cycleadmin', '(<lang>/)cycleadmin(/<model>(/<action>(/<id>)))', array(
'lang' => $lang_options,
'model' => '[a-z_]{0,}',
'action' => '[a-z_]+',
开发者_Python百科'id' => '\d+',
))->defaults(array(
'controller' => 'cycleadmin',
'lang' => DEFAULT_LANG,
'model' => 'cycle',
'action' => NULL,
));
Then I have the following uri request to generate the route:
echo Route::get('cycleadmin')->uri(array('action' => 'add'));
But this ends up only returning: /cycleadmin
I'm using Kohana 3.1 (v3.1.1.1). This worked perfectly in Kohana 3.0.9.
What am I missing?
Try to also set <model>
. Does it work?
Regards
Sorin
As of 3.1, the route::get()-method doesn't fill in the defaults - you have to manually specify every parameter. Don't ask me why, but it is intended behaviour (source: the official forums).
精彩评论