1 | <?php |
||
35 | class RelationalRepository extends EntityRepository implements Repository, EntitySpecificationRepositoryInterface |
||
36 | { |
||
37 | use RepositoryTrait; |
||
38 | use EventsTrait; |
||
39 | use FiltersTrait; |
||
40 | use PaginatorTrait; |
||
41 | use EntitySpecificationRepositoryTrait; |
||
42 | |||
43 | /** |
||
44 | * Class name. |
||
45 | * |
||
46 | * @var string |
||
47 | */ |
||
48 | protected $className; |
||
49 | |||
50 | /** |
||
51 | * Class alias. |
||
52 | * |
||
53 | * @var string |
||
54 | */ |
||
55 | protected $classAlias; |
||
56 | |||
57 | /** |
||
58 | * Get class alias. |
||
59 | * |
||
60 | * @return string |
||
61 | */ |
||
62 | protected function getClassAlias(): string |
||
70 | |||
71 | /** |
||
72 | * {@inheritdoc} |
||
73 | */ |
||
74 | public function getClassName(): string |
||
82 | |||
83 | /** |
||
84 | * Finds entities by a set of criteria. |
||
85 | * |
||
86 | * @param array $criteria |
||
87 | * @param array|null $orderBy |
||
88 | * @param int|null $limit |
||
89 | * @param int|null $offset |
||
90 | * |
||
91 | * @return ArrayCollection |
||
92 | * |
||
93 | * @codeCoverageIgnore |
||
94 | */ |
||
95 | public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) |
||
99 | |||
100 | /** |
||
101 | * {@inheritdoc} |
||
102 | */ |
||
103 | protected function getFilterCollection() |
||
107 | |||
108 | /** |
||
109 | * {@inheritdoc} |
||
110 | */ |
||
111 | protected function getManager(): EntityManager |
||
115 | |||
116 | /** |
||
117 | * {@inheritdoc} |
||
118 | * |
||
119 | * @param array $criteria |
||
120 | * @param array|null $orderBy |
||
121 | * @param int $itemsPerPage |
||
122 | * |
||
123 | * @return \Zend\Paginator\Paginator |
||
124 | */ |
||
125 | public function findPaginatedBy($criteria, array $orderBy = null, int $itemsPerPage = 10): Paginator |
||
131 | |||
132 | /** |
||
133 | * Get query builder from criteria array. |
||
134 | * |
||
135 | * @param array $criteria |
||
136 | * @param array|null $orderBy |
||
137 | * |
||
138 | * @return QueryBuilder |
||
139 | */ |
||
140 | protected function getQueryBuilderFromCriteria(array $criteria, array $orderBy = null): QueryBuilder |
||
158 | |||
159 | /** |
||
160 | * Add query builder criteria. |
||
161 | * |
||
162 | * @param QueryBuilder $queryBuilder |
||
163 | * @param string $field |
||
164 | * @param mixed $value |
||
165 | * @param string $entityAlias |
||
166 | */ |
||
167 | protected function addQueryCriteria(QueryBuilder $queryBuilder, string $field, $value, string $entityAlias) |
||
183 | |||
184 | /** |
||
185 | * Paginate query. |
||
186 | * |
||
187 | * @param Query $query |
||
188 | * @param int $itemsPerPage |
||
189 | * |
||
190 | * @return Paginator |
||
191 | */ |
||
192 | protected function paginate(Query $query, int $itemsPerPage = 10): Paginator |
||
196 | |||
197 | /** |
||
198 | * {@inheritdoc} |
||
199 | * |
||
200 | * @param array|QueryBuilder $criteria |
||
201 | * |
||
202 | * @return int |
||
203 | */ |
||
204 | public function countBy($criteria): int |
||
208 | |||
209 | /** |
||
210 | * Begin transaction. |
||
211 | */ |
||
212 | public function beginTransaction() |
||
216 | |||
217 | /** |
||
218 | * Commit transaction. |
||
219 | * |
||
220 | * @throws \Doctrine\DBAL\ConnectionException |
||
221 | */ |
||
222 | public function commit() |
||
226 | |||
227 | /** |
||
228 | * Rollback transaction. |
||
229 | * |
||
230 | * @throws \Doctrine\DBAL\ConnectionException |
||
231 | */ |
||
232 | public function rollBack() |
||
236 | } |
||
237 |