Completed
Push — master ( 1a9043...984777 )
by Valentyn
08:31
created

WatchedMovieRepository   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 16
ccs 0
cts 9
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getAllWatchedMoviesByGuestSessionId() 0 8 1
1
<?php
2
declare(strict_types=1);
3
4
namespace App\Guests\Repository;
5
6
use App\Guests\Entity\GuestWatchedMovie;
7
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
8
use Doctrine\ORM\Query;
9
use Symfony\Bridge\Doctrine\RegistryInterface;
10
11
/**
12
 * @method GuestWatchedMovie|null find($id, $lockMode = null, $lockVersion = null)
13
 * @method GuestWatchedMovie|null findOneBy(array $criteria, array $orderBy = null)
14
 * @method GuestWatchedMovie[]    findAll()
15
 * @method GuestWatchedMovie[]    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, GuestWatchedMovie::class);
22
    }
23
24
    public function getAllWatchedMoviesByGuestSessionId(int $guestSessionId): Query
25
    {
26
        return $this->createQueryBuilder('wm')
27
            ->where('wm.guestSession = :guestSessionId')
28
            ->setParameter('guestSessionId', $guestSessionId)
29
            ->addOrderBy('wm.id', 'DESC')
30
            ->getQuery();
31
    }
32
}
33