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\TestTableOneTwoEntity; |
7
|
|
|
|
8
|
|
|
class TestTableOneTwoRepository extends AbstractRepository |
9
|
|
|
{ |
10
|
|
|
/** |
11
|
|
|
* @param int $testTableOneId |
12
|
|
|
* @param int $testTableTwoId |
13
|
|
|
*/ |
14
|
|
|
public function create($testTableOneId, $testTableTwoId) |
15
|
|
|
{ |
16
|
|
|
$this |
17
|
|
|
->createQueryBuilder( |
18
|
|
|
(new TestTableOneTwoEntity()) |
19
|
|
|
->setTestTableOneId($testTableOneId) |
20
|
|
|
->setTestTableTwoId($testTableTwoId) |
21
|
|
|
) |
22
|
|
|
->insert() |
23
|
|
|
; |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* @return TestTableOneTwoEntity[] |
28
|
|
|
*/ |
29
|
|
|
public function read() |
30
|
|
|
{ |
31
|
|
|
return $this->createQueryBuilder()->orderBy(TestTableOneTwoEntity::COLUMN_TEST_TABLE_ONE_ID)->find(); |
|
|
|
|
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @return int |
36
|
|
|
*/ |
37
|
|
|
public function readCount() |
38
|
|
|
{ |
39
|
|
|
return $this->createQueryBuilder()->count(); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @param int $testTableOneIdCurrent |
44
|
|
|
* @param int $testTableTwoIdCurrent |
45
|
|
|
* @param int $testTableOneId |
46
|
|
|
* @param int $testTableTwoId |
47
|
|
|
* |
48
|
|
|
* @return TestTableOneTwoEntity |
49
|
|
|
*/ |
50
|
|
|
public function updateRow( |
51
|
|
|
$testTableOneIdCurrent, |
52
|
|
|
$testTableTwoIdCurrent, |
53
|
|
|
$testTableOneId, |
54
|
|
|
$testTableTwoId |
55
|
|
|
) { |
56
|
|
|
$testTableOneTwoEntity = $this |
57
|
|
|
->createQueryBuilder() |
58
|
|
|
->where('test_table_one_two.test_table_one_id = :test_table_one_id') |
59
|
|
|
->where('test_table_one_two.test_table_two_id = :test_table_two_id') |
60
|
|
|
->bind([ |
61
|
|
|
'test_table_one_id' => $testTableOneIdCurrent, |
62
|
|
|
'test_table_two_id' => $testTableTwoIdCurrent, |
63
|
|
|
]) |
64
|
|
|
->findOne() |
65
|
|
|
; |
66
|
|
|
|
67
|
|
|
$testTableOneTwoEntity |
68
|
|
|
->setTestTableOneId($testTableOneId) |
|
|
|
|
69
|
|
|
->setTestTableTwoId($testTableTwoId) |
70
|
|
|
; |
71
|
|
|
|
72
|
|
|
return $this->createQueryBuilder($testTableOneTwoEntity)->update(); |
|
|
|
|
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* @param TestTableOneTwoEntity $testTableOneTwoEntity |
77
|
|
|
* @param int $testTableOneId |
78
|
|
|
* @param int $testTableTwoId |
79
|
|
|
* |
80
|
|
|
* @return TestTableOneTwoEntity |
81
|
|
|
*/ |
82
|
|
|
public function updateEntity( |
83
|
|
|
TestTableOneTwoEntity $testTableOneTwoEntity, |
84
|
|
|
$testTableOneId, |
85
|
|
|
$testTableTwoId |
86
|
|
|
) { |
87
|
|
|
$testTableOneTwoEntity |
88
|
|
|
->setTestTableOneId($testTableOneId) |
89
|
|
|
->setTestTableTwoId($testTableTwoId) |
90
|
|
|
; |
91
|
|
|
|
92
|
|
|
return $this->createQueryBuilder($testTableOneTwoEntity)->update(); |
|
|
|
|
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* @param TestTableOneTwoEntity $testTableOneTwoEntity |
97
|
|
|
*/ |
98
|
|
|
public function deleteEntity(TestTableOneTwoEntity $testTableOneTwoEntity) |
99
|
|
|
{ |
100
|
|
|
$this->createQueryBuilder($testTableOneTwoEntity)->delete(); |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* @return string |
105
|
|
|
*/ |
106
|
|
|
protected function getEntityClass(): string |
107
|
|
|
{ |
108
|
|
|
return TestTableOneTwoEntity::class; |
109
|
|
|
} |
110
|
|
|
} |
111
|
|
|
|