2011-11-12 22:10:00 +01:00
|
|
|
<?php
|
|
|
|
|
2013-03-27 18:44:06 +01:00
|
|
|
namespace FOS\ElasticaBundle;
|
2011-11-12 22:10:00 +01:00
|
|
|
|
2013-03-27 18:44:06 +01:00
|
|
|
use FOS\ElasticaBundle\Finder\PaginatedFinderInterface;
|
2012-07-10 21:41:27 +02:00
|
|
|
|
2011-11-12 22:10:00 +01:00
|
|
|
/**
|
|
|
|
* @author Richard Miller <info@limethinking.co.uk>
|
|
|
|
*
|
2013-04-26 14:15:57 +02:00
|
|
|
* Basic repository to be extended to hold custom queries to be run
|
2011-11-12 22:10:00 +01:00
|
|
|
* in the finder.
|
|
|
|
*/
|
|
|
|
class Repository
|
|
|
|
{
|
|
|
|
protected $finder;
|
|
|
|
|
2012-07-10 21:41:27 +02:00
|
|
|
public function __construct(PaginatedFinderInterface $finder)
|
2011-11-12 22:10:00 +01:00
|
|
|
{
|
|
|
|
$this->finder = $finder;
|
|
|
|
}
|
|
|
|
|
2014-02-05 02:41:38 +01:00
|
|
|
public function find($query, $limit = null, $options = array())
|
2011-11-12 22:10:00 +01:00
|
|
|
{
|
2014-02-05 02:41:38 +01:00
|
|
|
return $this->finder->find($query, $limit, $options);
|
2011-11-12 22:10:00 +01:00
|
|
|
}
|
|
|
|
|
2014-02-05 02:41:38 +01:00
|
|
|
public function findHybrid($query, $limit = null, $options = array())
|
2011-11-12 22:10:00 +01:00
|
|
|
{
|
2014-02-05 02:41:38 +01:00
|
|
|
return $this->finder->findHybrid($query, $limit, $options);
|
2011-11-12 22:10:00 +01:00
|
|
|
}
|
|
|
|
|
2014-02-05 02:41:38 +01:00
|
|
|
public function findPaginated($query, $options = array())
|
2012-07-10 21:30:19 +02:00
|
|
|
{
|
2014-02-05 02:41:38 +01:00
|
|
|
return $this->finder->findPaginated($query, $options);
|
2012-07-10 21:30:19 +02:00
|
|
|
}
|
|
|
|
|
2014-02-05 02:41:38 +01:00
|
|
|
public function createPaginatorAdapter($query, $options = array())
|
2012-07-10 18:16:44 +02:00
|
|
|
{
|
2014-02-05 02:41:38 +01:00
|
|
|
return $this->finder->createPaginatorAdapter($query, $options);
|
2012-07-10 18:16:44 +02:00
|
|
|
}
|
2011-11-12 22:10:00 +01:00
|
|
|
}
|