Completed
Push — master ( ea0a23...156714 )
by Joachim
12s queued 11s
created

BrandRepository   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 20
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A createListQueryBuilder() 0 3 1
A findByPhrase() 0 7 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Loevgaard\SyliusBrandPlugin\Doctrine\ORM;
6
7
use Doctrine\ORM\QueryBuilder;
8
use Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository;
9
10
class BrandRepository extends EntityRepository implements BrandRepositoryInterface
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15
    public function createListQueryBuilder(): QueryBuilder
16
    {
17
        return $this->createQueryBuilder('o');
18
    }
19
20
    /**
21
     * {@inheritdoc}
22
     */
23
    public function findByPhrase(string $phrase): array
24
    {
25
        return $this->createQueryBuilder('o')
26
            ->andWhere('o.name LIKE :phrase OR o.code LIKE :phrase')
27
            ->setParameter('phrase', '%' . $phrase . '%')
28
            ->getQuery()
29
            ->getResult()
30
            ;
31
    }
32
}
33