InterestedMovieRepository::findOneByMovieId()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Users\Repository;
6
7
use App\Users\Entity\UserInterestedMovie;
8
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
9
use Symfony\Bridge\Doctrine\RegistryInterface;
10
11
/**
12
 * @method UserInterestedMovie|null find($id, $lockMode = null, $lockVersion = null)
13
 * @method UserInterestedMovie|null findOneBy(array $criteria, array $orderBy = null)
14
 * @method UserInterestedMovie[]    findAll()
15
 * @method UserInterestedMovie[]    findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
16
 */
17
class InterestedMovieRepository extends ServiceEntityRepository
18
{
19 2
    public function __construct(RegistryInterface $registry)
20
    {
21 2
        parent::__construct($registry, UserInterestedMovie::class);
22 2
    }
23
24 2
    public function findOneById(int $interestedMovieId, int $userId): ?UserInterestedMovie
25
    {
26 2
        return $this->findOneBy([
27 2
            'id' => $interestedMovieId,
28 2
            'user' => $userId,
29
        ]);
30
    }
31
32 2
    public function findOneByMovieId(int $movieId, int $userId): ?UserInterestedMovie
33
    {
34 2
        return $this->findOneBy([
35 2
            'movie' => $movieId,
36 2
            'user' => $userId,
37
        ]);
38
    }
39
}
40