Passed
Pull Request — master (#6287)
by
unknown
08:55
created

AccessUrlRelPluginRepository::__construct()   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
nc 1
nop 1
dl 0
loc 3
rs 10
c 1
b 0
f 0
1
<?php
2
3
/* For licensing terms, see /license.txt */
4
5
declare(strict_types=1);
6
7
namespace Chamilo\CoreBundle\Repository;
8
9
use Chamilo\CoreBundle\Entity\AccessUrlRelPlugin;
10
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
11
use Doctrine\Persistence\ManagerRegistry;
12
13
/**
14
 * @extends ServiceEntityRepository<AccessUrlRelPlugin>
15
 */
16
class AccessUrlRelPluginRepository extends ServiceEntityRepository
17
{
18
    public function __construct(ManagerRegistry $registry)
19
    {
20
        parent::__construct($registry, AccessUrlRelPlugin::class);
21
    }
22
23
    public function findOneByPluginName(string $pluginTitle, int $accessUrlId): ?AccessUrlRelPlugin
24
    {
25
        return $this->createQueryBuilder('rel')
26
            ->join('rel.plugin', 'p')
27
            ->andWhere('p.title = :pluginTitle')
28
            ->andWhere('rel.url = :accessUrlId')
29
            ->setParameter('pluginTitle', $pluginTitle)
30
            ->setParameter('accessUrlId', $accessUrlId)
31
            ->getQuery()
32
            ->getOneOrNullResult();
33
    }
34
}
35