Ejemplo n.º 1
0
 /**
  * The read action
  * @return \Zend\View\Model\JsonModel
  */
 public function readAction()
 {
     $id = $this->params()->fromPost('surveyId', null);
     if (!is_null($id)) {
         //filter by specific id
         $results = $this->getServiceLocator()->get("Api\\Service\\Survey")->fetchAll(array('id' => $id));
     } else {
         $results = $this->getServiceLocator()->get("Api\\Service\\Survey")->fetchAll();
     }
     return new \Zend\View\Model\JsonModel(array("result" => "true", "error" => "", "collection" => \Api\Service\Encoder\Survey::toJson($results)));
 }