findAllActiveByGatewayFactoryName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 10
nc 1
nop 1
dl 0
loc 12
rs 9.9332
c 0
b 0
f 0
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