Test Failed
Push — master ( f13730...efaef4 )
by Nico
22:43 queued 11:31
created

BuoyRepository::findByUserId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
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
}