1 | <?php |
||
33 | class RelationalRepository extends EntityRepository implements Repository, SpecificationAwareInterface |
||
34 | { |
||
35 | use SpecificationRepositoryTrait; |
||
36 | use RepositoryTrait; |
||
37 | use EventsTrait; |
||
38 | use PaginatorTrait; |
||
39 | |||
40 | /** |
||
41 | * Class alias. |
||
42 | * |
||
43 | * @var string |
||
44 | */ |
||
45 | protected $classAlias; |
||
46 | |||
47 | /** |
||
48 | * Get class alias. |
||
49 | * |
||
50 | * @return string |
||
51 | */ |
||
52 | protected function getClassAlias(): string |
||
53 | { |
||
54 | if ($this->classAlias === null) { |
||
55 | $this->classAlias = strtoupper($this->getEntityName()[0]); |
||
56 | } |
||
57 | |||
58 | return $this->classAlias; |
||
59 | } |
||
60 | |||
61 | /** |
||
62 | * {@inheritdoc} |
||
63 | */ |
||
64 | public function getClassName(): string |
||
68 | |||
69 | /** |
||
70 | * {@inheritdoc} |
||
71 | */ |
||
72 | protected function getManager(): EntityManager |
||
76 | |||
77 | /** |
||
78 | * {@inheritdoc} |
||
79 | * |
||
80 | * @param array $criteria |
||
81 | * @param array|null $orderBy |
||
82 | * @param int $itemsPerPage |
||
83 | * |
||
84 | * @return \Zend\Paginator\Paginator |
||
85 | */ |
||
86 | public function findPaginatedBy($criteria, array $orderBy = [], int $itemsPerPage = 10): Paginator |
||
92 | |||
93 | /** |
||
94 | * Get query builder from criteria array. |
||
95 | * |
||
96 | * @param array $criteria |
||
97 | * @param array $orderBy |
||
98 | * |
||
99 | * @return QueryBuilder |
||
100 | */ |
||
101 | protected function getQueryBuilderFromCriteria(array $criteria, array $orderBy = []): QueryBuilder |
||
129 | |||
130 | /** |
||
131 | * Paginate query. |
||
132 | * |
||
133 | * @param Query $query |
||
134 | * @param int $itemsPerPage |
||
135 | * |
||
136 | * @return Paginator |
||
137 | */ |
||
138 | protected function paginate(Query $query, int $itemsPerPage = 10): Paginator |
||
142 | |||
143 | /** |
||
144 | * {@inheritdoc} |
||
145 | * |
||
146 | * @param array|QueryBuilder $criteria |
||
147 | * |
||
148 | * @return int |
||
149 | */ |
||
150 | public function countBy($criteria): int |
||
154 | } |
||
155 |