2009年8月14日星期五

[fw-mvc] Zend_Rest_Route & Zend_Rest_Controller Mismatch?

I've setup the following REST Route for my "checkout" module:

$router->addRoute(
'rest',
new Zend_Rest_Route(
$this->_front,
array(),
array(
'checkout'
)
)
);

I've also implemented the following five methods from
Zend_Rest_Controller in my Checkout_ShippingController:

* indexAction()
* getAction()
* postAction()
* putAction()
* deleteAction()

I would expect that by navigating to checkout/shipping I would be
routed to Checkout_ShippingController::indexAction(). However, I'm
actually routed to Checkout_ShippingController::listAction() which I
had not implemented yet since it was not defined as an abstract method
in Zend_Rest_Controller (therefore getting an error). Is this by
design or is there a mismatch between Zend_Rest_Route and
Zend_Rest_Controller Mismatch? I suspect that either
Zend_Rest_Controller::indexAction is supposed to be named
Zend_Rest_Controller::listAction or that the default action for
Zend_Rest_Route should be "index" instead of "list". Of course I can
work around this by simply implementing an empty indexAction and
implement my own listAction, but this seems like an odd thing to have
to do (ignoring an abstract method I'm forced to implement and then
needing to implement a method that is not defined in the abstract
class in order to get the routing to work correctly).

Thanks,
Bradley

--
Bradley Holt
bradley.holt@foundline.com

没有评论: