Completed
Push — master ( 61c86f...9d729c )
by Valentyn
04:45
created

WatchedMovieRepository::findOneByMovieId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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