Completed
Push — master ( 016326...2f159d )
by Joachim
04:38
created

BrandRepository   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A findOneBySlug() 0 7 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Loevgaard\SyliusBrandPlugin\Repository;
6
7
use Loevgaard\SyliusBrandPlugin\Entity\BrandInterface;
8
use Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository;
9
10
class BrandRepository extends EntityRepository implements BrandRepositoryInterface
11
{
12
    /**
13
     * @param string $slug
14
     * @return BrandInterface|null
15
     * @throws \Doctrine\ORM\NonUniqueResultException
16
     */
17
    public function findOneBySlug(string $slug): ?BrandInterface
18
    {
19
        return $this->createQueryBuilder('o')
20
            ->where('o.slug = :slug')
21
            ->setParameter('slug', $slug)
22
            ->getQuery()
23
            ->getOneOrNullResult()
24
        ;
25
    }
26
}