During Zend_Controller_Action::init()
, is there a way to cancel the action (so it won't be called)?
<?php
class JsonApiController extends Zend_Controller_Action {
function init()
{
// try JSON decoding the raw request body
if ($jsonDecodingFailed) {
echo '{"error":"invalid JSON"}';
$this->_cancelAction(); // something like this exist?
}
}
}
My current workaround is to make an empty nullAction()
method and call $this->_forward('null')
to forward to it.