Issues (106)

src/Orm/PageRepo.php (4 issues)

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]);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->getFromDat... $conditions, $params)) could return the type object which is incompatible with the type-hinted return array. Consider adding an additional type-check to rule them out.
Loading history...
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]);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->getFromDat...r', array($identifier)) could return the type array<mixed,object> which is incompatible with the type-hinted return AbterPhp\Website\Domain\Entities\Page|null. Consider adding an additional type-check to rule them out.
Loading history...
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]);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->getFromDat...t', array($identifier)) could return the type array<mixed,object> which is incompatible with the type-hinted return AbterPhp\Website\Domain\Entities\Page|null. Consider adding an additional type-check to rule them out.
Loading history...
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]);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->getFromDat...', array($identifiers)) could return the type object which is incompatible with the type-hinted return array. Consider adding an additional type-check to rule them out.
Loading history...
65
    }
66
}
67