<?php
namespace Doctrine\Search;

use Doctrine\Common\Collections\ArrayCollection;

/**
 * Class ElasticsearchEntityCollection
 *
 * This is a decorator to the array collection for collection of elasticsearch entities
 *
 * @package Doctrine\Search
 */
class ElasticsearchEntityCollection extends ArrayCollection {

    /** @var integer */
    private $total = 0;

    /**
     * @return integer
     */
    public function getTotal() {
        return $this->total;
    }

    /**
     * @param integer $total
     */
    public function setTotal($total) {
        $this->total = $total;
    }

}
<?php
namespace Doctrine\Search;

use Doctrine\Common\Collections\ArrayCollection;

/**
 * Class ElasticsearchEntityCollection
 *
 * This is a decorator to the array collection for collection of elasticsearch entities
 *
 * @package Doctrine\Search
 */
class ElasticsearchEntityCollection extends ArrayCollection {

    /** @var integer */
    private $total = 0;

    /**
     * @return integer
     */
    public function getTotal() {
        return $this->total;
    }

    /**
     * @param integer $total
     */
    public function setTotal($total) {
        $this->total = $total;
    }

    /**
     * @return array
     */
    public function toEntitiesAndTotal() {
        return array(
            'entities' => $this->toArray(),
            'total'    => $this->getTotal()
        );
    }
}
Add method to convert collection to entities/total
Add method to convert collection to entities/total

Change-Id: I29763fc910f4a62cd6ff2a9bd05b4c4e62e6890f
