Zend\Mvc\Controller\AbstractRestfulController::getList PHP Method

getList() public method

Return list of resources
public getList ( ) : mixed
return mixed
    public function getList()
    {
        $this->response->setStatusCode(405);
        return ['content' => 'Method Not Allowed'];
    }

Usage Example

Example #1
0
 public function getList()
 {
     if (!$this->getOptions()->getRestEnabled()) {
         return parent::getList();
     }
     $this->getResponse()->getHeaders()->addHeaderLine('Content-Type', 'application/json');
     $result = array();
     $items = $this->getAll();
     foreach ($items as $item) {
         $result[] = $this->itemToSerializable($item);
     }
     return new JsonModel($result);
 }