PaymentRepository::findOneBySubscriptionId()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.9
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PH\Bundle\CoreBundle\Doctrine\ORM;
6
7
use PH\Component\Core\Model\PaymentInterface;
8
use PH\Component\Core\Repository\PaymentRepositoryInterface;
9
use Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository;
10
11
class PaymentRepository extends EntityRepository implements PaymentRepositoryInterface
12
{
13
    /**
14
     * {@inheritdoc}
15
     */
16
    public function findOneBySubscriptionId(string $paymentId, string $subscriptionId): ?PaymentInterface
17
    {
18
        return $this->createQueryBuilder('o')
19
            ->andWhere('o.id = :paymentId')
20
            ->andWhere('o.subscription = :id')
21
            ->setParameter('paymentId', $paymentId)
22
            ->setParameter('id', $subscriptionId)
23
            ->getQuery()
24
            ->getOneOrNullResult()
25
        ;
26
    }
27
}
28