#5569: requestAction conflicts with admin routing
-------------------------------+--------------------------------------------
Reporter: lukaslt | Owner: nate
Type: Enhancement | Status: new
Priority: Medium | Milestone:
Component: General | Version:
Severity: Normal | Resolution:
Keywords: | Php_version: PHP 5
Cake_version: 1.2.0.7692 RC3 |
-------------------------------+--------------------------------------------
Changes (by nate):
* version: RC3 =>
* type: Bug => Enhancement
* milestone: 1.2.x.x =>
Comment:
@troynt:
[[BR]][[BR]]
My apologies for the lack of clarity, but you misunderstand my meaning.
By way of an explanation, here's a little background on how admin routes
work: early in the development cycle of 1.2, some refactoring work was
done on admin routes to make their handling more generic (i.e. less of a
hack). One of the new features that came out of this work was the ability
to apply custom action prefixes to any route, i.e.:
{{{
Router::connect('/foo/:controller/:action', array('prefix' => 'foo', 'bar'
=> true));
}}}
This allows URLs like {{{/foo/posts/show}}} to map to
{{{PostsController::foo_show()}}}. The reason for the {{{'bar' => true}}}
flag is that {{{'prefix'}}} is a custom key which is not factored into
forward or reverse routing. Without the flag, all URLs would match that
route, resulting in all URLs dispatching to actions prefixed with
{{{"foo_"}}}. So, other than URLs automatically inheriting that
{{{'admin'}}} flag from their environment (another dirty hack I'd love
nothing more than to do away with -- but can't for BC's sake), admin
routes are actually not special. There's nothing in the route parsing or
generating process that happens that makes admin routes any different than
any other custom route you can do yourself.
[[BR]][[BR]]
So that's the long way of saying that your patch breaks this feature. In
other words, when I say that it "creates a special case," what I really
mean is that, with your patch applied, the following test should pass:
{{{
Router::connect('/foo/:controller/:action', array('prefix' =>
'foo', 'bar' => true));
$result = Router::url(array('controller' => 'posts', 'action' =>
'foo_show'));
$this->assertEqual($result, '/foo/posts/show');
}}}
It doesn't.
[[BR]][[BR]]
Furthermore, such a change would have to be benchmarked, as
{{{Router::url()}}} is an oft-used method. The amount of overhead
required to make this work properly would almost certainly not be worth
the negligible syntax benefits.
--
Ticket URL: <https://trac.cakephp.org/ticket/5569#comment:10>
CakePHP : The Rapid Development Framework for PHP <https://trac.cakephp.org/>
Cake is a rapid development framework for PHP which uses commonly known design
patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC.
Our primary goal is to provide a structured framework that enables PHP users at
all levels to rapidly develop robust web applications, without any loss to
flexibility.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"tickets cakephp" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/tickets-cakephp?hl=en
-~----------~----~----~----~------~----~------~--~---