1 | <?php |
||
8 | abstract class AbstractDoctrineRepository implements RepositoryInterface |
||
9 | { |
||
10 | /** |
||
11 | * @var Connection |
||
12 | */ |
||
13 | private $connection; |
||
14 | |||
15 | /** |
||
16 | * @param Connection $connection |
||
17 | */ |
||
18 | public function __construct(Connection $connection) |
||
22 | |||
23 | /** |
||
24 | * @param string $id |
||
25 | * |
||
26 | * @return ModelInterface|null |
||
27 | */ |
||
28 | public function find(string $id) |
||
43 | |||
44 | /** |
||
45 | * @param array $criteria |
||
46 | * |
||
47 | * @return null|ModelInterface |
||
48 | */ |
||
49 | public function findOneBy(array $criteria = []) |
||
63 | |||
64 | /** |
||
65 | * @param array $criteria |
||
66 | * |
||
67 | * @return ModelInterface[]|array |
||
68 | */ |
||
69 | public function findBy(array $criteria = []): array |
||
87 | |||
88 | /** |
||
89 | * @param array $criteria |
||
90 | * |
||
91 | * @return QueryBuilder |
||
92 | */ |
||
93 | private function getFindByQueryBuilder(array $criteria = []): QueryBuilder |
||
105 | |||
106 | /** |
||
107 | * @param ModelInterface $model |
||
108 | */ |
||
109 | public function insert(ModelInterface $model) |
||
113 | |||
114 | /** |
||
115 | * @param ModelInterface $model |
||
116 | */ |
||
117 | public function update(ModelInterface $model) |
||
121 | |||
122 | /** |
||
123 | * @param ModelInterface $model |
||
124 | */ |
||
125 | public function delete(ModelInterface $model) |
||
129 | |||
130 | /** |
||
131 | * @return string |
||
132 | */ |
||
133 | abstract protected function getTable(): string; |
||
134 | } |
||
135 |