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

findOneByUserAndServiceProvider()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 5
ccs 0
cts 5
cp 0
crap 2
rs 10
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
}