1 | <?php |
||
12 | class ElasticEntityRepository implements ObjectRepository { |
||
13 | |||
14 | /** @var string */ |
||
15 | protected $_entityName; |
||
16 | |||
17 | /** @var ElasticEntityManager */ |
||
18 | protected $_em; |
||
19 | |||
20 | public function __construct(ElasticEntityManager $em, $className) { |
||
24 | |||
25 | /** |
||
26 | * Finds an object by its primary key / identifier. |
||
27 | * |
||
28 | * @param mixed $id The identifier. |
||
29 | * |
||
30 | * @return object The object. |
||
31 | */ |
||
32 | public function find($id) { |
||
35 | |||
36 | /** |
||
37 | * Finds all objects in the repository. |
||
38 | * |
||
39 | * @return array The objects. |
||
40 | */ |
||
41 | public function findAll() { |
||
44 | |||
45 | /** |
||
46 | * Finds objects by a set of criteria. |
||
47 | * |
||
48 | * Optionally sorting and limiting details can be passed. An implementation may throw |
||
49 | * an UnexpectedValueException if certain values of the sorting or limiting details are |
||
50 | * not supported. |
||
51 | * |
||
52 | * @param array $criteria |
||
53 | * @param array|null $orderBy |
||
54 | * @param int|null $limit |
||
55 | * @param int|null $offset |
||
56 | * |
||
57 | * @return array The objects. |
||
58 | * |
||
59 | * @throws \UnexpectedValueException |
||
60 | */ |
||
61 | public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) { |
||
66 | |||
67 | /** |
||
68 | * Finds a single object by a set of criteria. |
||
69 | * |
||
70 | * @param array $criteria The criteria. |
||
71 | * @param array $orderBy |
||
72 | * @return object The object. |
||
73 | */ |
||
74 | public function findOneBy(array $criteria, array $orderBy = null) { |
||
79 | |||
80 | /** |
||
81 | * Returns the class name of the object managed by the repository. |
||
82 | * |
||
83 | * @return string |
||
84 | */ |
||
85 | public function getClassName() { |
||
88 | |||
89 | /** |
||
90 | * Creates a new QueryBuilder instance that is prepopulated for this entity name. |
||
91 | * |
||
92 | * @param string $alias |
||
93 | * @param string $indexBy The index for the from. |
||
94 | * |
||
95 | * @return ElasticQueryBuilder |
||
96 | */ |
||
97 | public function createQueryBuilder($alias, $indexBy = null) { |
||
102 | } |