concerning the $amfResponse variable you are using: do you want to give it an AMF-Byte-String or the object that should be serialized?
For integration in MVC you already have different possibilities:
1. Register $this in the extended ActionController-Class (in your case "Services AmfController") as the handling class and let it call its methods:
class YourNS_Controller_Action_AMF extends Zend_Controller_Action
{
protected $_server;
public function init() {
$this->_server = new Zend_Amf_Server();
$this->_server->setClass($this);
$this->_helper->viewRenderer->setNoRender();
echo $this->_server->handle();
exit;
}
}
class MyController extends YourNS_Controller_Action_AMF
{
public function funcToBeCalledByFlash($a, $b) {
return $a+$b;
}
}
this has the downside, that any public function Zend_Action_Controller has can be called by AMF.
2. create the request yourself and change the target to handle this yourself (and allow only methods you want it to allow):
class YourNS_Controller_Action_AMF extends Zend_Controller_Action
{
private $_server;
private $_forbiddenMethods = array();
private static $_originalTargetMethods = array();
public function init () {
$this->_server = new Zend_Amf_Server();
$this->_server->setClass($this);
$this->_forbiddenMethods = array();
$this->_request = new Zend_AMF_Request_Http();
$responseBody = $this->_request->getAmfBodies();
foreach($responseBody as $body) {
$method = '...TODO:get the correct method out of target URI...';
if (in_array($method, $this->_forbiddenMethods))
throw new Zend_Amf_Server_Exception('Method "' . $method . '" must not be called');
self::$_originalTargetMethods[] = $method;
$body->setTargetURI('TODO:getthecorrectleading'.'handlerFunction');
}
echo $this->_server->handle();
exit;
}
public function handlerFunction() {
$method = array_shift(self::$_originalTargetMethods);
return $this->_response->getBody();
}
}
Is this what you intended or did i understand you wrong?
concerning the $amfResponse variable you are using: do you want to give it an AMF-Byte-String or the object that should be serialized?
For integration in MVC you already have different possibilities:
1. Register $this in the extended ActionController-Class (in your case "Services AmfController") as the handling class and let it call its methods:
this has the downside, that any public function Zend_Action_Controller has can be called by AMF.
2. create the request yourself and change the target to handle this yourself (and allow only methods you want it to allow):
Is this what you intended or did i understand you wrong?