ZF-7437: Zend_Rest_Route defaulting to a non-existent 'listAction'
Description
When extending Zend_Rest_Controller you are required to define the index, get, post, put, and delete actions.
Yet Zend_Rest_Route attempts to call the non-existent 'listAction' in the following block of code in match():
// Check for leading "special get" URI's
$specialGetTarget = false;
if ($pathElementCount && array_search($path[0], array('index', 'new')) > -1) {
$specialGetTarget = array_shift($path);
} elseif ($pathElementCount == 1) {
$params['id'] = array_shift($path);
} elseif ($pathElementCount == 0 || $pathElementCount > 1) {
$specialGetTarget = 'list';
}
This results in the following exception and trace:
Exception information:
Message: Action "list" does not exist and was not trapped in __call()
Stack trace:
#0 /Users/hobodave/dev/php/blog/library/Zend/Controller/Action.php(515): Zend_Controller_Action->__call('listAction', Array)
#1 /Users/hobodave/dev/php/blog/library/Zend/Controller/Dispatcher/Standard.php(289): Zend_Controller_Action->dispatch('listAction')
The documentation doesn't mention any 'listAction', which leads me to believe the correct solution is to change 'list' to 'index'.
Comments
Posted by David Abdemoulaie (hobodave) on 2009-07-31T22:06:31.000+0000
Attached patch creating a new unit test to cover this, as well as the fix.
Posted by Holger Schäfer (hschaefer123) on 2009-08-14T05:23:34.000+0000
I'm using rest services implementing Zend_Rest_Controller as action controller. The service interface lacks the used listAction. Fixing this problems maybe needs also changes in the service interface (listAction()....)
Posted by Luke Crouch (groovecoder) on 2009-08-19T06:47:14.000+0000
Hey guys ... sorry for the delay.
I'll get started on this and the other Zend_Rest bugs ASAP.
thanks, -L
Posted by Satoru Yoshida (satoruyoshida) on 2009-08-21T19:04:45.000+0000
Set component and change assinee
Posted by Satoru Yoshida (satoruyoshida) on 2009-08-25T22:30:04.000+0000
Set Fix Version. may be SVN r17812.