Completed
Push — master ( 38e61c...cd9a17 )
by Julito
14:03
created

CQuizRepository::find()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nop 1
dl 0
loc 3
rs 10
nc 1
1
<?php
2
/* For licensing terms, see /license.txt */
3
4
namespace Chamilo\CourseBundle\Repository;
5
6
use Chamilo\CoreBundle\Entity\Resource\ResourceLink;
7
use Chamilo\CoreBundle\Entity\Resource\ResourceNode;
8
use Chamilo\CoreBundle\Entity\Resource\ResourceRight;
9
use Chamilo\CoreBundle\Repository\ResourceRepository;
10
use Chamilo\CoreBundle\Security\Authorization\Voter\ResourceNodeVoter;
11
use Chamilo\CourseBundle\Entity\CQuiz;
12
use Doctrine\ORM\EntityManager;
13
use Doctrine\ORM\EntityRepository;
14
use Gaufrette\Exception\FileNotFound;
15
use League\Flysystem\FilesystemInterface;
16
use League\Flysystem\MountManager;
17
18
/**
19
 * Class CQuizRepository.
20
 */
21
class CQuizRepository extends ResourceRepository
22
{
23
    /**
24
     * @var EntityRepository
25
     */
26
    private $repository;
27
28
    /**
29
     * @var FilesystemInterface
30
     */
31
    private $fs;
32
33
    /**
34
     * CQuizRepository constructor.
35
     *
36
     * @param EntityManager $entityManager
37
     * @param MountManager  $mountManager
38
     */
39
    public function __construct(EntityManager $entityManager, MountManager $mountManager)
40
    {
41
        $this->repository = $entityManager->getRepository(CQuiz::class);
42
        $this->fs = $mountManager->getFilesystem('resources_fs');
43
        $this->entityManager = $entityManager;
44
    }
45
46
    /**
47
     * @param int $id
48
     *
49
     * @return CQuiz|null
50
     */
51
    public function find(int $id): ?CQuiz
52
    {
53
        return $this->repository->find($id);
54
    }
55
56
    /**
57
     * @param array      $criteria
58
     * @param array|null $orderBy
59
     *
60
     * @return CQuiz|null
61
     */
62
    public function findOneBy(array $criteria, array $orderBy = null): ?CQuiz
63
    {
64
        return $this->repository->findOneBy($criteria, $orderBy);
65
    }
66
}
67