Passed
Push — main ( d7832a...2d8ac8 )
by Daniel
04:45
created

GenreRepository::save()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
ccs 0
cts 3
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Uxmp\Core\Orm\Repository;
6
7
use Doctrine\ORM\EntityRepository;
8
use JetBrains\PhpStorm\Pure;
9
use Uxmp\Core\Orm\Model\Genre;
10
use Uxmp\Core\Orm\Model\GenreInterface;
11
12
/**
13
 * @extends EntityRepository<GenreInterface>
14
 *
15
 * @method null|GenreInterface findOneBy(mixed[] $criteria)
16
 */
17
final class GenreRepository extends EntityRepository implements GenreRepositoryInterface
18
{
19
    #[Pure]
20
    public function prototype(): GenreInterface
21
    {
22
        return new Genre();
23
    }
24
25
    public function save(GenreInterface $genre): void
26
    {
27
        $this->getEntityManager()->persist($genre);
28
        $this->getEntityManager()->flush();
29
    }
30
31
    public function delete(GenreInterface $genre): void
32
    {
33
        $this->getEntityManager()->remove($genre);
34
        $this->getEntityManager()->flush();
35
    }
36
}
37