1 | <?php |
||
11 | class EntityRepository implements ObjectRepository |
||
12 | { |
||
13 | /** @var ApiMetadata */ |
||
14 | private $metadata; |
||
15 | /** @var EntityManager */ |
||
16 | private $manager; |
||
17 | |||
18 | /** |
||
19 | * EntityRepository constructor. |
||
20 | * |
||
21 | * @param EntityManager $manager |
||
22 | * @param string $className |
||
23 | */ |
||
24 | 13 | public function __construct(EntityManager $manager, $className) |
|
29 | |||
30 | /** |
||
31 | * Finds an object by its primary key / identifier. |
||
32 | * |
||
33 | * @param mixed $id The identifier. |
||
34 | * |
||
35 | * @return object The object. |
||
36 | */ |
||
37 | 10 | public function find($id) |
|
41 | |||
42 | /** |
||
43 | * Returns the class name of the object managed by the repository. |
||
44 | * |
||
45 | * @return string |
||
46 | */ |
||
47 | 10 | public function getClassName() |
|
51 | |||
52 | /** |
||
53 | * Finds all objects in the repository. |
||
54 | * |
||
55 | * @return array The objects. |
||
56 | */ |
||
57 | public function findAll() |
||
61 | |||
62 | /** |
||
63 | * Finds objects by a set of criteria. |
||
64 | * |
||
65 | * Optionally sorting and limiting details can be passed. An implementation may throw |
||
66 | * an UnexpectedValueException if certain values of the sorting or limiting details are |
||
67 | * not supported. |
||
68 | * |
||
69 | * @param array $criteria |
||
70 | * @param array|null $orderBy |
||
71 | * @param int|null $limit |
||
72 | * @param int|null $offset |
||
73 | * |
||
74 | * @return array The objects. |
||
75 | * |
||
76 | * @throws \UnexpectedValueException |
||
77 | */ |
||
78 | 2 | public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) |
|
82 | |||
83 | /** |
||
84 | * Finds a single object by a set of criteria. |
||
85 | * |
||
86 | * @param array $criteria The criteria. |
||
87 | * |
||
88 | * @return object The object. |
||
89 | */ |
||
90 | public function findOneBy(array $criteria) |
||
96 | |||
97 | /** |
||
98 | * @return EntityManager |
||
99 | */ |
||
100 | public function getManager() |
||
104 | |||
105 | /** |
||
106 | * @param array $criteria |
||
107 | * @param array|null $orderBy |
||
108 | * @param int|null $limit |
||
109 | * @param int|null $offset |
||
110 | * |
||
111 | * @return Collection |
||
112 | */ |
||
113 | 3 | public function createLazyCollection(array $criteria, array $orderBy = null, $limit = null, $offset = null) |
|
117 | |||
118 | /** |
||
119 | * @return RpcClientInterface |
||
120 | */ |
||
121 | 1 | protected function getClient() |
|
125 | |||
126 | /** |
||
127 | * @return ApiMetadata |
||
128 | */ |
||
129 | 1 | protected function getMetadata() |
|
133 | |||
134 | /** |
||
135 | * Hydrates object from given data or merges it to already fetched object |
||
136 | * |
||
137 | * @param mixed $data |
||
138 | * |
||
139 | * @return object |
||
140 | */ |
||
141 | protected function hydrateObject($data) |
||
145 | } |
||
146 |