ZF-7656: Creating a rest controller automatically makes the default index controller also rest-based.

Issue Type: Bug Created: 2009-08-21T13:20:07.000+0000 Last Updated: 2009-12-21T17:09:44.000+0000 Status: Resolved Fix version(s): - 1.10.0 (27/Jan/10)

Reporter: Onno Lissenberg (orlissenberg) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_Rest_Route

Related issues: Attachments:


if I define a rest controller from a module to be a rest route, the index controller from the module also becomes a rest controller:


$front->getRouter()->addRoute('guides::rules', new Zend_Rest_Route($front, array(),array('guides'=>array('rules'))));

This would cause the "guides" module's "index" controller to become a rest controller, unless I later override it with:

$front->getRouter()->addRoute('guides', new Zend_Controller_Router_Route('guides/', array( 'module' => 'guides', 'controller' => 'index', 'action' => 'index' )));

which is basically a patch on the wound.


Posted by Luke Crouch (lcrouch) on 2009-08-25T13:59:25.000+0000

Can you tell me the exact HTTP request that gave this behavior?

e.g., GET /guides/index/index ?

Thanks, -L

Posted by Onno Lissenberg (orlissenberg) on 2009-09-01T00:36:08.000+0000

Seems to be resolved in the current version!


Posted by Tim Brayshaw (twisty) on 2009-11-27T04:42:34.000+0000

I don't think this is resolved. Here are two tests for Zend_Rest_RouteTest (excuse the hideous method names!) to confirm...

<pre class="highlight">
public function test_postToNonRESTfulDefaultController_moduleHasAnotherRESTfulController_defaultControllerInURL_returnsFalse()
    $request = $this->_buildRequest('POST', '/mod/index');
    $config = array('mod'=>array('user'));
    $values = $this->_invokeRouteMatch($request, $config);


public function test_postToNonRESTfulDefaultController_moduleHasAnotherRESTfulController_noDefaultControllerInURL_returnsFalse()
    $request = $this->_buildRequest('POST', '/mod');
    $config = array('mod'=>array('user'));
    $values = $this->_invokeRouteMatch($request, $config);


The first test passes, the second fails.

<pre class="literal">
1) Zend_Rest_RouteTest::test_postToNonRESTfulDefaultController_moduleHasAnotherRESTfulController_noDefaultControllerInURL_returnsFalse
Failed asserting that 
    [module] => mod
    [action] => post
    [controller] => index

Cheers, Tim.

Posted by Luke Crouch (lcrouch) on 2009-12-21T17:09:44.000+0000

I added the missing controller check in the case of default, non-URI controllers. Good catch! Thanks for posting the exact test methods too - that made it much easier to fix.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.