Passed
Push — master ( aff96c...cdda13 )
by
unknown
14:50 queued 08:02
created

findAllByFactoryNameAndCode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 10
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
/*
4
 * This file has been created by developers from BitBag.
5
 * Feel free to contact us once you face any issues or want to start
6
 * You can find more information about us on https://bitbag.io and write us
7
 * an email on [email protected].
8
 */
9
10
declare(strict_types=1);
11
12
namespace BitBag\SyliusMolliePlugin\Repository;
13
14
use BitBag\SyliusMolliePlugin\Factory\MollieGatewayFactory;
15
use Sylius\Bundle\CoreBundle\Doctrine\ORM\PaymentMethodRepository as BasePaymentMethodRepository;
16
17
class PaymentMethodRepository extends BasePaymentMethodRepository implements PaymentMethodRepositoryInterface
18
{
19
    public function findAllByFactoryNameAndCode(string $code): array
20
    {
21
        return $this->createQueryBuilder('o')
22
            ->innerJoin('o.gatewayConfig', 'gatewayConfig')
23
            ->where('gatewayConfig.factoryName = :factoryName')
24
            ->andWhere('o.code != :code')
25
            ->setParameter('factoryName', MollieGatewayFactory::FACTORY_NAME)
26
            ->setParameter('code', $code)
27
            ->getQuery()
28
            ->getResult()
29
        ;
30
    }
31
}
32