PaymentRepository   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A findAllActiveByGatewayFactoryName() 0 12 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
 * another great project.
7
 * You can find more information about us on https://bitbag.shop and write us
8
 * an email on [email protected].
9
 */
10
11
declare(strict_types=1);
12
13
namespace BitBag\SyliusQuadPayPlugin\Repository;
14
15
use Sylius\Bundle\CoreBundle\Doctrine\ORM\PaymentRepository as BasePaymentRepository;
16
use Sylius\Component\Core\Model\PaymentInterface;
17
18
final class PaymentRepository extends BasePaymentRepository implements PaymentRepositoryInterface
19
{
20
    public function findAllActiveByGatewayFactoryName(string $gatewayFactoryName): array
21
    {
22
        return $this->createQueryBuilder('o')
23
            ->innerJoin('o.method', 'method')
24
            ->innerJoin('method.gatewayConfig', 'gatewayConfig')
25
            ->where('gatewayConfig.factoryName = :gatewayFactoryName')
26
            ->andWhere('o.state = :stateNew OR o.state = :stateProcessing')
27
            ->setParameter('gatewayFactoryName', $gatewayFactoryName)
28
            ->setParameter('stateNew', PaymentInterface::STATE_NEW)
29
            ->setParameter('stateProcessing', PaymentInterface::STATE_PROCESSING)
30
            ->getQuery()
31
            ->getResult()
32
        ;
33
    }
34
}
35