DemoLessonRepository::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 1
c 1
b 0
f 1
dl 0
loc 3
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
namespace App\Repository;
4
5
use App\Entity\DemoLesson;
6
use App\Model\CourseInterface;
7
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
8
use Doctrine\Persistence\ManagerRegistry;
9
10
/**
11
 * @method DemoLesson|null find($id, $lockMode = null, $lockVersion = null)
12
 * @method DemoLesson|null findOneBy(array $criteria, array $orderBy = null)
13
 * @method DemoLesson[]    findAll()
14
 * @method DemoLesson[]    findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
15
 */
16
class DemoLessonRepository extends ServiceEntityRepository implements DemoLessonRepositoryInterface
17
{
18
    public function __construct(ManagerRegistry $registry)
19
    {
20
        parent::__construct($registry, DemoLesson::class);
21
    }
22
23
    public function findAllForCourse(CourseInterface $course): array
24
    {
25
        return $this->createQueryBuilder('dl')
26
            ->where('m.course = :course')
27
            ->leftJoin('dl.lesson', 'l')
28
            ->leftJoin('l.module', 'm')
29
            ->setParameter('course', $course)
30
            ->getQuery()
31
            ->getResult();
32
    }
33
}
34