FOSElasticaBundle/Repository.php

68 lines
1.5 KiB
PHP
Raw Permalink Normal View History

<?php
namespace FOS\ElasticaBundle;
use FOS\ElasticaBundle\Finder\PaginatedFinderInterface;
/**
* @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
* in the finder.
*/
class Repository
{
protected $finder;
public function __construct(PaginatedFinderInterface $finder)
{
$this->finder = $finder;
}
2014-08-24 11:50:56 +02:00
/**
2015-03-12 11:20:00 +01:00
* @param mixed $query
2014-08-24 11:50:56 +02:00
* @param integer $limit
2015-03-12 11:20:00 +01:00
* @param array $options
*
2014-08-24 11:50:56 +02:00
* @return array
*/
public function find($query, $limit = null, $options = array())
{
return $this->finder->find($query, $limit, $options);
}
2014-08-24 11:50:56 +02:00
/**
2015-03-12 11:20:00 +01:00
* @param mixed $query
2014-08-24 11:50:56 +02:00
* @param integer $limit
2015-03-12 11:20:00 +01:00
* @param array $options
*
2014-08-24 11:50:56 +02:00
* @return mixed
*/
public function findHybrid($query, $limit = null, $options = array())
{
return $this->finder->findHybrid($query, $limit, $options);
}
2014-08-24 11:50:56 +02:00
/**
* @param mixed $query
* @param array $options
2015-03-12 11:20:00 +01:00
*
2014-08-24 11:50:56 +02:00
* @return \Pagerfanta\Pagerfanta
*/
public function findPaginated($query, $options = array())
2012-07-10 21:30:19 +02:00
{
return $this->finder->findPaginated($query, $options);
2012-07-10 21:30:19 +02:00
}
2014-08-24 11:50:56 +02:00
/**
* @param string $query
2015-03-12 11:20:00 +01:00
* @param array $options
*
2014-08-24 11:50:56 +02:00
* @return Paginator\PaginatorAdapterInterface
*/
public function createPaginatorAdapter($query, $options = array())
{
return $this->finder->createPaginatorAdapter($query, $options);
}
}