Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 19 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
SolvPersonRepository | |
0.00% |
0 / 19 |
|
0.00% |
0 / 3 |
12 | |
0.00% |
0 / 1 |
getSolvPersonsMarkedForMerge | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
2 | |||
resetSolvPersonSameAs | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
2 | |||
deleteById | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | namespace Olz\Repository; |
4 | |
5 | use Olz\Entity\SolvPerson; |
6 | use Olz\Repository\Common\OlzRepository; |
7 | |
8 | /** |
9 | * @extends OlzRepository<SolvPerson> |
10 | */ |
11 | class SolvPersonRepository extends OlzRepository { |
12 | protected string $solv_person_class = SolvPerson::class; |
13 | |
14 | /** @return array<array{id: int, same_as: int}> */ |
15 | public function getSolvPersonsMarkedForMerge() { |
16 | $dql = " |
17 | SELECT sp.id, sp.same_as |
18 | FROM {$this->solv_person_class} sp |
19 | WHERE sp.same_as IS NOT NULL |
20 | "; |
21 | $query = $this->getEntityManager()->createQuery($dql); |
22 | return $query->getResult(); |
23 | } |
24 | |
25 | public function resetSolvPersonSameAs(int $id): mixed { |
26 | $sane_id = intval($id); |
27 | $dql = " |
28 | UPDATE {$this->solv_person_class} sp |
29 | SET sp.same_as IS NULL |
30 | WHERE sp.id = '{$sane_id}' |
31 | "; |
32 | $query = $this->getEntityManager()->createQuery($dql); |
33 | return $query->execute(); |
34 | } |
35 | |
36 | public function deleteById(int $id): mixed { |
37 | $sane_id = intval($id); |
38 | $dql = " |
39 | DELETE {$this->solv_person_class} sp |
40 | WHERE sp.id = '{$sane_id}' |
41 | "; |
42 | $query = $this->getEntityManager()->createQuery($dql); |
43 | return $query->execute(); |
44 | } |
45 | } |