1 | <?php |
||
16 | class EntityRepository implements ObjectRepository |
||
17 | { |
||
18 | /** @var ApiMetadata */ |
||
19 | private $metadata; |
||
20 | /** @var EntityManager */ |
||
21 | private $manager; |
||
22 | |||
23 | /** |
||
24 | * EntityRepository constructor. |
||
25 | * |
||
26 | * @param EntityManager $manager |
||
27 | * @param string $className |
||
28 | */ |
||
29 | 12 | public function __construct(EntityManager $manager, $className) |
|
34 | |||
35 | /** |
||
36 | * Finds an object by its primary key / identifier. |
||
37 | * |
||
38 | * @param mixed $id The identifier. |
||
39 | * |
||
40 | * @return object The object. |
||
41 | */ |
||
42 | 9 | public function find($id) |
|
46 | |||
47 | /** |
||
48 | * Returns the class name of the object managed by the repository. |
||
49 | * |
||
50 | * @return string |
||
51 | */ |
||
52 | 9 | public function getClassName() |
|
56 | |||
57 | /** |
||
58 | * Finds all objects in the repository. |
||
59 | * |
||
60 | * @return array The objects. |
||
61 | */ |
||
62 | public function findAll() |
||
66 | |||
67 | /** |
||
68 | * Finds objects by a set of criteria. |
||
69 | * |
||
70 | * Optionally sorting and limiting details can be passed. An implementation may throw |
||
71 | * an UnexpectedValueException if certain values of the sorting or limiting details are |
||
72 | * not supported. |
||
73 | * |
||
74 | * @param array $criteria |
||
75 | * @param array|null $orderBy |
||
76 | * @param int|null $limit |
||
77 | * @param int|null $offset |
||
78 | * |
||
79 | * @return array The objects. |
||
80 | * |
||
81 | * @throws \UnexpectedValueException |
||
82 | */ |
||
83 | 3 | public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) |
|
87 | |||
88 | /** |
||
89 | * Finds a single object by a set of criteria. |
||
90 | * |
||
91 | * @param array $criteria The criteria. |
||
92 | * |
||
93 | * @return object The object. |
||
94 | */ |
||
95 | public function findOneBy(array $criteria) |
||
101 | |||
102 | /** |
||
103 | * @return RpcClientInterface |
||
104 | */ |
||
105 | 1 | protected function getClient() |
|
109 | |||
110 | /** |
||
111 | * @return ApiMetadata |
||
112 | */ |
||
113 | 1 | protected function getMetadata() |
|
117 | |||
118 | /** |
||
119 | * @return EntityManager |
||
120 | */ |
||
121 | public function getManager() |
||
125 | } |
||
126 |