Passed
Pull Request — master (#35)
by Paweł
05:12
created

BookmarkRepository   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
eloc 7
c 1
b 0
f 1
dl 0
loc 14
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getAllForLesson() 0 7 1
A __construct() 0 3 1
1
<?php
2
3
namespace App\Repository;
4
5
use App\Entity\Bookmark;
6
use App\Model\LessonInterface;
7
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
8
use Symfony\Bridge\Doctrine\RegistryInterface;
9
10
/**
11
 * @method Bookmark|null find($id, $lockMode = null, $lockVersion = null)
12
 * @method Bookmark|null findOneBy(array $criteria, array $orderBy = null)
13
 * @method Bookmark[]    findAll()
14
 * @method Bookmark[]    findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
15
 */
16
class BookmarkRepository extends ServiceEntityRepository implements BookmarkRepositoryInterface
17
{
18
    public function __construct(RegistryInterface $registry)
19
    {
20
        parent::__construct($registry, Bookmark::class);
21
    }
22
23
    public function getAllForLesson(LessonInterface $lesson): array
24
    {
25
        return $this->createQueryBuilder('b')
26
            ->where('b.lesson = :lesson')
27
            ->setParameter('lesson', $lesson)
28
            ->getQuery()
29
            ->getResult()
30
            ;
31
    }
32
}
33