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 | 12 | 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 | 11 | 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) |
|
84 | |||
85 | /** |
||
86 | * Finds a single object by a set of criteria. |
||
87 | * |
||
88 | * @param array $criteria The criteria. |
||
89 | * |
||
90 | * @return object The object. |
||
91 | */ |
||
92 | public function findOneBy(array $criteria) |
||
98 | |||
99 | /** |
||
100 | * @return EntityManager |
||
101 | */ |
||
102 | public function getManager() |
||
106 | |||
107 | /** |
||
108 | * @return RpcClientInterface |
||
109 | */ |
||
110 | 1 | protected function getClient() |
|
114 | |||
115 | /** |
||
116 | * @return ApiMetadata |
||
117 | */ |
||
118 | 1 | protected function getMetadata() |
|
122 | |||
123 | /** |
||
124 | * Hydrates object from given data or merges it to already fetched object |
||
125 | * |
||
126 | * @param mixed $data |
||
127 | * |
||
128 | * @return object |
||
129 | */ |
||
130 | protected function hydrateObject($data) |
||
134 | |||
135 | /** |
||
136 | * @param string $alias |
||
137 | * |
||
138 | * @return string |
||
139 | * @throws \OutOfBoundsException if no method exist |
||
140 | */ |
||
141 | protected function getClientMethod($alias) |
||
145 | } |
||
146 |