1 | <?php |
||
9 | class EntityRepository implements ObjectRepository |
||
10 | { |
||
11 | /** @var ApiMetadata */ |
||
12 | private $metadata; |
||
13 | /** @var EntityManager */ |
||
14 | private $manager; |
||
15 | |||
16 | /** |
||
17 | * EntityRepository constructor. |
||
18 | * |
||
19 | * @param EntityManager $manager |
||
20 | * @param string $className |
||
21 | */ |
||
22 | 13 | public function __construct(EntityManager $manager, $className) |
|
27 | |||
28 | /** |
||
29 | * Finds an object by its primary key / identifier. |
||
30 | * |
||
31 | * @param mixed $id The identifier. |
||
32 | * |
||
33 | * @return object The object. |
||
34 | */ |
||
35 | 10 | public function find($id) |
|
39 | |||
40 | /** |
||
41 | * Returns the class name of the object managed by the repository. |
||
42 | * |
||
43 | * @return string |
||
44 | */ |
||
45 | 12 | public function getClassName() |
|
49 | |||
50 | /** |
||
51 | * Finds all objects in the repository. |
||
52 | * |
||
53 | * @return array The objects. |
||
54 | */ |
||
55 | public function findAll() |
||
59 | |||
60 | /** |
||
61 | * Finds objects by a set of criteria. |
||
62 | * |
||
63 | * Optionally sorting and limiting details can be passed. An implementation may throw |
||
64 | * an UnexpectedValueException if certain values of the sorting or limiting details are |
||
65 | * not supported. |
||
66 | * |
||
67 | * @param array $criteria |
||
68 | * @param array|null $orderBy |
||
69 | * @param int|null $limit |
||
70 | * @param int|null $offset |
||
71 | * |
||
72 | * @return array The objects. |
||
73 | * |
||
74 | * @throws \UnexpectedValueException |
||
75 | */ |
||
76 | 3 | 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 | * @return RpcClientInterface |
||
107 | */ |
||
108 | 1 | protected function getClient() |
|
112 | |||
113 | /** |
||
114 | * @return ApiMetadata |
||
115 | */ |
||
116 | 1 | protected function getMetadata() |
|
120 | |||
121 | /** |
||
122 | * Hydrates object from given data or merges it to already fetched object |
||
123 | * |
||
124 | * @param mixed $data |
||
125 | * |
||
126 | * @return object |
||
127 | */ |
||
128 | protected function hydrateObject($data) |
||
132 | |||
133 | /** |
||
134 | * @param string $alias |
||
135 | * |
||
136 | * @return string |
||
137 | * @throws \OutOfBoundsException if no method exist |
||
138 | */ |
||
139 | protected function getClientMethod($alias) |
||
143 | } |
||
144 |