Completed
Push — master ( a3cce1...d6fbcc )
by Marcel
09:39
created

ServiceProviderConfirmationRepository   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 27.27%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 19
ccs 3
cts 11
cp 0.2727
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A persist() 0 3 1
A findOneByUserAndServiceProvider() 0 5 1
A __construct() 0 2 1
1
<?php
2
3
namespace App\Repository;
4
5
use App\Entity\ServiceProvider;
6
use App\Entity\ServiceProviderConfirmation;
7
use App\Entity\User;
8
use Doctrine\ORM\EntityManagerInterface;
9
10
class ServiceProviderConfirmationRepository implements ServiceProviderConfirmationRepositoryInterface {
11
12
    private $em;
13
14 1
    public function __construct(EntityManagerInterface $entityManager) {
15 1
        $this->em = $entityManager;
16 1
    }
17
18
    public function findOneByUserAndServiceProvider(User $user, ServiceProvider $serviceProvider): ?ServiceProviderConfirmation {
19
        return $this->em->getRepository(ServiceProviderConfirmation::class)
20
            ->findOneBy([
21
                'user' => $user,
22
                'serviceProvider' => $serviceProvider
23
            ]);
24
    }
25
26
    public function persist(ServiceProviderConfirmation $confirmation) {
27
        $this->em->persist($confirmation);
28
        $this->em->flush();
29
    }
30
}