Passed
Push — main ( 024f60...c8b1e7 )
by Daniel
03:34
created

AlbumRepository::delete()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Uxmp\Core\Orm\Repository;
6
7
use Doctrine\ORM\EntityRepository;
8
use Uxmp\Core\Orm\Model\Album;
9
use Uxmp\Core\Orm\Model\AlbumInterface;
10
11
/**
12
 * @extends EntityRepository<AlbumInterface>
13
 *
14
 * @method AlbumInterface[] findBy(mixed[] $criteria, null|array $order = null, null|int $limit = null, null|int $offset = null)
15
 */
16
final class AlbumRepository extends EntityRepository implements AlbumRepositoryInterface
17
{
18 1
    public function prototype(): AlbumInterface
19
    {
20 1
        return new Album();
21
    }
22
23 1
    public function save(AlbumInterface $album): void
24
    {
25 1
        $em = $this->getEntityManager();
26
27 1
        $em->persist($album);
28 1
        $em->flush();
29 1
    }
30
31 1
    public function findByMbId(string $mbid): ?AlbumInterface
32
    {
33 1
        return $this->findOneBy([
34 1
            'mbid' => $mbid
35
        ]);
36
    }
37
38 1
    public function delete(AlbumInterface $album): void
39
    {
40 1
        $em = $this->getEntityManager();
41
42 1
        $em->remove($album);
43 1
        $em->flush();
44 1
    }
45
}
46