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; |
10
|
|
|
use Opulence\Orm\Repositories\Repository; |
11
|
|
|
|
12
|
|
|
class PageRepo extends Repository implements IGridRepo |
13
|
|
|
{ |
14
|
|
|
/** |
15
|
|
|
* @param int $limitFrom |
16
|
|
|
* @param int $pageSize |
17
|
|
|
* @param string[] $orders |
18
|
|
|
* @param array $conditions |
19
|
|
|
* @param array $params |
20
|
|
|
* |
21
|
|
|
* @return Entity[] |
22
|
|
|
*/ |
23
|
|
|
public function getPage(int $limitFrom, int $pageSize, array $orders, array $conditions, array $params): array |
24
|
|
|
{ |
25
|
|
|
/** @see PageSqlDataMapper::getPage() */ |
26
|
|
|
return $this->getFromDataMapper('getPage', [$limitFrom, $pageSize, $orders, $conditions, $params]); |
|
|
|
|
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @param string $identifier |
31
|
|
|
* |
32
|
|
|
* @return Entity|null |
33
|
|
|
* @throws \Opulence\Orm\OrmException |
34
|
|
|
*/ |
35
|
|
|
public function getByIdentifier(string $identifier): ?Entity |
36
|
|
|
{ |
37
|
|
|
/** @see PageSqlDataMapper::getByIdentifier() */ |
38
|
|
|
return $this->getFromDataMapper('getByIdentifier', [$identifier]); |
|
|
|
|
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @param string $identifier |
43
|
|
|
* |
44
|
|
|
* @return Entity|null |
45
|
|
|
* @throws \Opulence\Orm\OrmException |
46
|
|
|
*/ |
47
|
|
|
public function getWithLayout(string $identifier): ?Entity |
48
|
|
|
{ |
49
|
|
|
/** @see PageSqlDataMapper::getWithLayout() */ |
50
|
|
|
return $this->getFromDataMapper('getWithLayout', [$identifier]); |
|
|
|
|
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @param array $identifiers |
55
|
|
|
* |
56
|
|
|
* @return Entity[] |
57
|
|
|
*/ |
58
|
|
|
public function getByCategoryIdentifiers(array $identifiers): array |
59
|
|
|
{ |
60
|
|
|
/** @see PageSqlDataMapper::getByCategoryIdentifiers() */ |
61
|
|
|
return $this->getFromDataMapper('getByCategoryIdentifiers', [$identifiers]); |
|
|
|
|
62
|
|
|
} |
63
|
|
|
} |
64
|
|
|
|