ProductRepositoryTrait   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 20
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A createPaginatorForBrand() 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 Loevgaard\SyliusBrandPlugin\Model\BrandInterface;
9
10
trait ProductRepositoryTrait
11
{
12
    /**
13
     * @param string $alias
14
     * @param string|null $indexBy The index for the from.
15
     *
16
     * @return QueryBuilder
17
     */
18
    abstract public function createQueryBuilder($alias, $indexBy = null);
19
20
    /**
21
     * {@inheritdoc}
22
     */
23
    public function createPaginatorForBrand(BrandInterface $brand): iterable
24
    {
25
        return $this->createQueryBuilder('o')
26
            ->where('o.brand = :brand')
27
            ->setParameter('brand', $brand)
28
            ->getQuery()
29
            ->getResult()
30
            ;
31
    }
32
}
33