Question

If I build a custom API (class) and want to pass the values obtained from an API call to my controller, how do I do that? Usually I have do this in my controller:

$form = new Application_My_Form();
$model = new Application_My_Model($form->getValues());

But since I'm not using a form and there isn't a view, then how do I post/pass the values from my API to the controller's action? Is there a better way to pass an array of values from my API class to a controller?

Was it helpful?

Solution

So your API is built within your ZF application? And you are within the controller for your API? You can access input parameters using

$params = $this->getRequest()->getParams();

which will give you an associative array of supplied parameters.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top