Test Failed
Push — dev ( 708190...bf98d5 )
by Nico
07:04
created

TorpedoHullRepository::delete()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 5
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\TorpedoHullInterface;
9
use Stu\Orm\Entity\TorpedoHull;
10
11
12
/**
13
 * @extends EntityRepository<TorpedoHull>
14
 */
15
final class TorpedoHullRepository extends EntityRepository implements TorpedoHullRepositoryInterface
16
{
17
    public function prototype(): TorpedoHullInterface
18
    {
19
        return new TorpedoHull();
20
    }
21
22
    public function save(TorpedoHullInterface $torpedohull): void
23
    {
24
        $em = $this->getEntityManager();
25
26
        $em->persist($torpedohull);
27
    }
28
29
    public function delete(TorpedoHullInterface $torpedohull): void
30
    {
31
        $em = $this->getEntityManager();
32
33
        $em->remove($torpedohull);
34
    }
35
36
    public function getByModuleAndTorpedo(
37
        int $moduleId,
38
        int $torpedoId
39
    ): ?TorpedoHullInterface {
40
        return $this->findOneBy([
41
            'module_id' => $moduleId,
42
            'torpedo_type' => $torpedoId
43
        ]);
44
    }
45
}
46