Passed
Push — main ( e933de...5ef56a )
by Daniel
03:35
created

UserRepository::save()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
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\User;
10
use Uxmp\Core\Orm\Model\UserInterface;
11
12
/**
13
 * @extends EntityRepository<User>
14
 *
15
 * @method null|UserInterface findOneBy(mixed[] $criteria)
16
 * @method null|UserInterface find(mixed $id)
17
 */
18
final class UserRepository extends EntityRepository implements UserRepositoryInterface
19
{
20 1
    #[Pure]
21
    public function prototype(): UserInterface
22
    {
23 1
        return new User();
24
    }
25
26 1
    public function save(UserInterface $user): void
27
    {
28 1
        $this->getEntityManager()->persist($user);
29 1
        $this->getEntityManager()->flush();
30
    }
31
32 1
    public function delete(UserInterface $user): void
33
    {
34 1
        $this->getEntityManager()->remove($user);
35 1
        $this->getEntityManager()->flush();
36
    }
37
}
38