SubscriptionRepository::findOneByOrderId()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 7
rs 10
c 0
b 0
f 0
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\Entity\SubscriptionInterface;
15
use Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository;
16
17
class SubscriptionRepository extends EntityRepository implements SubscriptionRepositoryInterface
18
{
19
    public function findOneByOrderId($orderId): ?SubscriptionInterface
20
    {
21
        return $this->createQueryBuilder('o')
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->createQuer...)->getOneOrNullResult() could return the type integer which is incompatible with the type-hinted return BitBag\SyliusMolliePlugi...scriptionInterface|null. Consider adding an additional type-check to rule them out.
Loading history...
22
            ->where('o.order = :orderId')
23
            ->setParameter('orderId', $orderId)
24
            ->getQuery()
25
            ->getOneOrNullResult()
26
        ;
27
    }
28
}
29