namespace Discount\Controller;
use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\JsonModel;
use Zend\Debug\Debug;
use Zend\Http\Headers;
class Api extends AbstractActionController
{
protected $Mapper = null;
public function indexAction()
{
return new JsonModel([]);
}
public function addAction()
{
return new JsonModel([]);
}
public function editAction()
{
return new JsonModel([]);
}
public function deleteAction()
{
echo $this->params()->fromRoute('id');
return new JsonModel([$this->params()->fromRoute('id')]);
}
public function setDiscountMapper(\Discount\Mapper\Discount $Mapper){
$this->Mapper = $Mapper;
}
public function setHeaders(\Zend\Http\Headers $Headers)
{
$this->getResponse()
->setHeaders($Headers)
->sendHeaders();
}
}
Я даже заголовки решил уже в ручную послать.
P.S. тестирую все на deleteAction