1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace AbterPhp\Website\Orm; |
6
|
|
|
|
7
|
|
|
use AbterPhp\Framework\Orm\IGridRepo; |
8
|
|
|
use AbterPhp\Website\Domain\Entities\Page as Entity; |
9
|
|
|
use AbterPhp\Website\Orm\DataMappers\PageSqlDataMapper as DataMapper; // @phan-suppress-current-line PhanUnreferencedUseNormal |
10
|
|
|
use Opulence\Orm\OrmException; |
11
|
|
|
use Opulence\Orm\Repositories\Repository; |
12
|
|
|
|
13
|
|
|
class PageRepo extends Repository implements IGridRepo |
14
|
|
|
{ |
15
|
|
|
/** |
16
|
|
|
* @param int $limitFrom |
17
|
|
|
* @param int $pageSize |
18
|
|
|
* @param string[] $orders |
19
|
|
|
* @param array $conditions |
20
|
|
|
* @param array $params |
21
|
|
|
* |
22
|
|
|
* @return Entity[] |
23
|
|
|
* @throws OrmException |
24
|
|
|
*/ |
25
|
|
|
public function getPage(int $limitFrom, int $pageSize, array $orders, array $conditions, array $params): array |
26
|
|
|
{ |
27
|
|
|
/** @see DataMapper::getPage() */ |
28
|
|
|
return $this->getFromDataMapper('getPage', [$limitFrom, $pageSize, $orders, $conditions, $params]); |
|
|
|
|
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @param string $identifier |
33
|
|
|
* |
34
|
|
|
* @return Entity|null |
35
|
|
|
* @throws OrmException |
36
|
|
|
*/ |
37
|
|
|
public function getByIdentifier(string $identifier): ?Entity |
38
|
|
|
{ |
39
|
|
|
/** @see DataMapper::getByIdentifier() */ |
40
|
|
|
return $this->getFromDataMapper('getByIdentifier', [$identifier]); |
|
|
|
|
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @param string $identifier |
45
|
|
|
* |
46
|
|
|
* @return Entity|null |
47
|
|
|
* @throws OrmException |
48
|
|
|
*/ |
49
|
|
|
public function getWithLayout(string $identifier): ?Entity |
50
|
|
|
{ |
51
|
|
|
/** @see DataMapper::getWithLayout() */ |
52
|
|
|
return $this->getFromDataMapper('getWithLayout', [$identifier]); |
|
|
|
|
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @param string[] $identifiers |
57
|
|
|
* |
58
|
|
|
* @return Entity[] |
59
|
|
|
* @throws OrmException |
60
|
|
|
*/ |
61
|
|
|
public function getByCategoryIdentifiers(array $identifiers): array |
62
|
|
|
{ |
63
|
|
|
/** @see DataMapper::getByCategoryIdentifiers() */ |
64
|
|
|
return $this->getFromDataMapper('getByCategoryIdentifiers', [$identifiers]); |
|
|
|
|
65
|
|
|
} |
66
|
|
|
} |
67
|
|
|
|