Completed
Push — master ( 965050...d738fe )
by Paweł
19:21 queued 06:52
created

getQueryBuilderForChoiceType()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 10
rs 9.4285
cc 2
eloc 5
nc 2
nop 1
1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Sylius\Bundle\PaymentBundle\Doctrine\ORM;
13
14
use Sylius\Bundle\TranslationBundle\Doctrine\ORM\TranslatableResourceRepository;
15
use Sylius\Component\Payment\Repository\PaymentMethodRepositoryInterface;
16
17
/**
18
 * @author Arnaud Langlade <[email protected]>
19
 */
20
class PaymentMethodRepository extends TranslatableResourceRepository implements PaymentMethodRepositoryInterface
21
{
22
    /**
23
     * {@inheritdoc}
24
     */
25
    public function getQueryBuilderForChoiceType(array $options)
26
    {
27
        $queryBuilder = $this->getCollectionQueryBuilder();
28
29
        if (!$options['disabled']) {
30
            $queryBuilder->where('method.enabled = true');
31
        }
32
33
        return $queryBuilder;
34
    }
35
36
    protected function getAlias()
37
    {
38
        return 'method';
39
    }
40
}
41