Zend Framework

Zend_Rest_Route defaulting to a non-existent 'listAction'

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.9.0
  • Fix Version/s: 1.10.0
  • Component/s: Zend_Rest_Route
  • Labels:
    None

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'.

Issue Links

Activity

Hide
David Abdemoulaie added a comment -

Attached patch creating a new unit test to cover this, as well as the fix.

Show
David Abdemoulaie added a comment - Attached patch creating a new unit test to cover this, as well as the fix.
Hide
Holger Schäfer added a comment -

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()....)

Show
Holger Schäfer added a comment - 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()....)
Hide
Luke Crouch added a comment -

Hey guys ... sorry for the delay.

I'll get started on this and the other Zend_Rest bugs ASAP.

thanks,
-L

Show
Luke Crouch added a comment - Hey guys ... sorry for the delay. I'll get started on this and the other Zend_Rest bugs ASAP. thanks, -L
Hide
Satoru Yoshida added a comment -

Set component and change assinee

Show
Satoru Yoshida added a comment - Set component and change assinee
Hide
Satoru Yoshida added a comment -

Set Fix Version. may be SVN r17812.

Show
Satoru Yoshida added a comment - Set Fix Version. may be SVN r17812.

People

Vote (1)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: