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) |
||
43 | |||
44 | /** |
||
45 | * @param string $modelClass |
||
46 | * @param string|null $id |
||
47 | * |
||
48 | * @return ModelInterface|null |
||
49 | */ |
||
50 | public function find(string $modelClass, string $id = null) |
||
58 | |||
59 | /** |
||
60 | * @param string $modelClass |
||
61 | * @param array $criteria |
||
62 | * @param array|null $orderBy |
||
63 | * |
||
64 | * @return ModelInterface|null |
||
65 | */ |
||
66 | public function findOneBy(string $modelClass, array $criteria, array $orderBy = null) |
||
70 | |||
71 | /** |
||
72 | * @param string $modelClass |
||
73 | * @param array $criteria |
||
74 | * @param array|null $orderBy |
||
75 | * @param int|null $limit |
||
76 | * @param int|null $offset |
||
77 | * |
||
78 | * @return array |
||
79 | */ |
||
80 | public function findBy( |
||
89 | |||
90 | /** |
||
91 | * @param ModelInterface $model |
||
92 | */ |
||
93 | public function persist(ModelInterface $model) |
||
97 | |||
98 | /** |
||
99 | * @param ModelInterface $model |
||
100 | */ |
||
101 | public function remove(ModelInterface $model) |
||
105 | |||
106 | /** |
||
107 | * @param string $modelClass |
||
108 | * |
||
109 | * @return RepositoryInterface |
||
110 | */ |
||
111 | private function getRepositoryByClass(string $modelClass): RepositoryInterface |
||
123 | } |
||
124 |