TestTableTwoRepository::read()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace Janisbiz\LightOrm\Tests\Behat\Bootstrap\Generated\LightOrmMysql\Repository;
4
5
use Janisbiz\LightOrm\Dms\MySQL\Repository\AbstractRepository;
6
use Janisbiz\LightOrm\Tests\Behat\Bootstrap\Generated\LightOrmMysql\Entity\TestTableTwoEntity;
7
8
class TestTableTwoRepository extends AbstractRepository
9
{
10
    /**
11
     * @param null|int $id
12
     *
13
     * @return TestTableTwoEntity
14
     */
15
    public function create(?int $id)
16
    {
17
        $testTableTwoEntity = (new TestTableTwoEntity())->setId($id);
18
19
        $this
20
            ->createQueryBuilder($testTableTwoEntity)
21
            ->insert()
22
        ;
23
24
        return $testTableTwoEntity;
25
    }
26
27
    /**
28
     * @return TestTableTwoEntity[]
29
     */
30
    public function read()
31
    {
32
        return $this->createQueryBuilder()->find();
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->createQueryBuilder()->find() returns the type Janisbiz\LightOrm\Entity\EntityInterface[]|string which is incompatible with the documented return type Janisbiz\LightOrm\Tests\...ty\TestTableTwoEntity[].
Loading history...
33
    }
34
35
    /**
36
     * @return int
37
     */
38
    public function readCount()
39
    {
40
        return $this->createQueryBuilder()->count();
41
    }
42
43
    /**
44
     * @param TestTableTwoEntity $testTableTwoEntity
45
     */
46
    public function deleteEntity(TestTableTwoEntity $testTableTwoEntity)
47
    {
48
        $this->createQueryBuilder($testTableTwoEntity)->delete();
49
    }
50
51
    /**
52
     * @return string
53
     */
54
    protected function getEntityClass(): string
55
    {
56
        return TestTableTwoEntity::class;
57
    }
58
}
59