Test Failed
Pull Request — master (#1764)
by Nico
12:03
created

BuoyRepository   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 34
rs 10
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A findByMapId() 0 3 1
A save() 0 5 1
A findBySysMapId() 0 3 1
A delete() 0 5 1
A findByUserId() 0 3 1
A prototype() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stu\Orm\Repository;
6
7
use Doctrine\ORM\EntityRepository;
8
use Stu\Orm\Entity\Buoy;
9
use Stu\Orm\Entity\BuoyInterface;
10
11
12
/**
13
 * @extends EntityRepository<Buoy>
14
 */
15
final class BuoyRepository extends EntityRepository implements BuoyRepositoryInterface
16
{
17
    public function prototype(): BuoyInterface
18
    {
19
        return new Buoy();
20
    }
21
22
    public function save(BuoyInterface $buoy): void
23
    {
24
        $em = $this->getEntityManager();
25
26
        $em->persist($buoy);
27
    }
28
29
    public function delete(BuoyInterface $buoy): void
30
    {
31
        $em = $this->getEntityManager();
32
33
        $em->remove($buoy);
34
    }
35
36
    public function findByMapId(int $mapId): array
37
    {
38
        return $this->findBy(['map_id' => $mapId]);
39
    }
40
41
    public function findBySysMapId(int $sysMapId): array
42
    {
43
        return $this->findBy(['sys_map_id' => $sysMapId]);
44
    }
45
46
    public function findByUserId(int $userId): array
47
    {
48
        return $this->findBy(['user_id' => $userId]);
49
    }
50
}