1 | <?php |
||
9 | final class Resolver implements ResolverInterface |
||
10 | { |
||
11 | /** |
||
12 | * @var ContainerInterface|RepositoryInterface[] |
||
13 | */ |
||
14 | private $container; |
||
15 | |||
16 | /** |
||
17 | * @var string[]|array |
||
18 | */ |
||
19 | private $repositoryKeys; |
||
20 | |||
21 | /** |
||
22 | * @param ContainerInterface $container |
||
23 | * @param array $repositoryKeys |
||
24 | */ |
||
25 | public function __construct(ContainerInterface $container, array $repositoryKeys) |
||
30 | |||
31 | /** |
||
32 | * @param string $name |
||
33 | * @param array $arguments |
||
34 | * |
||
35 | * @return mixed |
||
36 | */ |
||
37 | public function __call($name, $arguments) |
||
51 | |||
52 | /** |
||
53 | * @param string $modelClass |
||
54 | * @param string $id |
||
55 | * |
||
56 | * @return ModelInterface|null |
||
57 | */ |
||
58 | public function find(string $modelClass, string $id) |
||
62 | |||
63 | /** |
||
64 | * @param string $modelClass |
||
65 | * @param array $criteria |
||
66 | * @param array|null $orderBy |
||
67 | * |
||
68 | * @return ModelInterface|null |
||
69 | */ |
||
70 | public function findOneBy(string $modelClass, array $criteria, array $orderBy = null) |
||
74 | |||
75 | /** |
||
76 | * @param string $modelClass |
||
77 | * @param array $criteria |
||
78 | * @param array|null $orderBy |
||
79 | * @param int|null $limit |
||
80 | * @param int|null $offset |
||
81 | * |
||
82 | * @return array |
||
83 | */ |
||
84 | public function findBy( |
||
93 | |||
94 | /** |
||
95 | * @param string $modelClass |
||
96 | * @param string $id |
||
97 | * |
||
98 | * @return \Closure |
||
99 | */ |
||
100 | public function lazyFind(string $modelClass, string $id): \Closure |
||
106 | |||
107 | /** |
||
108 | * @param string $modelClass |
||
109 | * @param array $criteria |
||
110 | * @param array|null $orderBy |
||
111 | * |
||
112 | * @return \Closure |
||
113 | */ |
||
114 | public function lazyFindOneBy(string $modelClass, array $criteria, array $orderBy = null): \Closure |
||
120 | |||
121 | /** |
||
122 | * @param string $modelClass |
||
123 | * @param array $criteria |
||
124 | * @param array|null $orderBy |
||
125 | * @param int|null $limit |
||
126 | * @param int|null $offset |
||
127 | * |
||
128 | * @return \Closure |
||
129 | */ |
||
130 | public function lazyFindBy( |
||
141 | |||
142 | /** |
||
143 | * @param ModelInterface $model |
||
144 | */ |
||
145 | public function persist(ModelInterface $model) |
||
149 | |||
150 | /** |
||
151 | * @param ModelInterface $model |
||
152 | */ |
||
153 | public function remove(ModelInterface $model) |
||
157 | |||
158 | /** |
||
159 | * @param string $modelClass |
||
160 | * |
||
161 | * @return RepositoryInterface |
||
162 | */ |
||
163 | private function getRepositoryByClass(string $modelClass): RepositoryInterface |
||
175 | } |
||
176 |