FOSElasticaBundle/Paginator/FantaPaginatorAdapter.php

64 lines
1.2 KiB
PHP
Raw Normal View History

<?php
namespace FOS\ElasticaBundle\Paginator;
use Pagerfanta\Adapter\AdapterInterface;
class FantaPaginatorAdapter implements AdapterInterface
{
private $adapter;
/**
2013-11-14 16:04:08 +01:00
* @param \FOS\ElasticaBundle\Paginator\PaginatorAdapterInterface $adapter
*/
public function __construct(PaginatorAdapterInterface $adapter)
{
$this->adapter = $adapter;
}
/**
* Returns the number of results.
*
* @return integer The number of results.
*/
public function getNbResults()
{
return $this->adapter->getTotalHits();
}
/**
2015-03-12 11:20:00 +01:00
* Returns Facets.
*
* @return mixed
*/
public function getFacets()
{
return $this->adapter->getFacets();
}
2015-03-12 11:45:24 +01:00
2014-10-08 19:32:24 +02:00
/**
2015-03-12 11:45:24 +01:00
* Returns Aggregations.
2014-10-08 19:32:24 +02:00
*
* @return mixed
*
* @api
*/
public function getAggregations()
{
return $this->adapter->getAggregations();
}
/**
2013-11-14 16:04:08 +01:00
* Returns a slice of the results.
*
* @param integer $offset The offset.
* @param integer $length The length.
*
* @return array|\Traversable The slice.
*/
public function getSlice($offset, $length)
{
2012-06-13 20:28:16 +02:00
return $this->adapter->getResults($offset, $length)->toArray();
}
}