Completed
Push — master ( 665a2d...66f2ad )
by Valentyn
03:38
created

WatchedMovieRepository   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 15
ccs 7
cts 7
cp 1
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A findOneByMovieId() 0 7 1
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 2
    public function __construct(RegistryInterface $registry)
20
    {
21 2
        parent::__construct($registry, UserWatchedMovie::class);
22 2
    }
23
24 1
    public function findOneByMovieId(int $movieId, int $userId): ?UserWatchedMovie
25
    {
26 1
        return $this->findOneBy([
27 1
            'movie' => $movieId,
28 1
            'user' => $userId,
29
        ]);
30
    }
31
}
32