Empty pagination after post request

For programming and general questions on Zend Framework
Post Reply
Posts: 1
Joined: Sun Oct 15, 2017 10:33 pm

Empty pagination after post request

Post by kay1818 » Sun Oct 15, 2017 10:50 pm

I built a rest api using zf-rest. I want to send data via post. The api should make a database call with the posted data and answer with a collection of hal entities wrapped by a paginator:

public function create($data) {
  $inputFilter = $this->getInputFilter();

  /** @type ZF\Hal\Entity[] $result */
  $result = $database->select($inputFilter);

  return Zend\Paginator\Paginator(new ResultAdapter($result, count($result));

class ResultAdapter implements AdapterInterface {
  protected $data = null;
  protected $resultCount = null;

  public function __construct(array $data = [], $resultCount = 0) {
    $this->data = $data;
    $this->resultCount = $resultCount;

  public function getItems($offset, $itemCountPerPage) {
   return $this->data;

  public function count() {
    return $this->resultCount;

I checked the result variable and it is an array with the correct output (about 1000 elements).
But everything I will get from the api is an empty paginator json:


Is there a special config I have to set or is my return wrong?

Post Reply