Passed
Push — master ( aad1d3...713f8f )
by
unknown
07:45
created

findByOrderNumberAndDateTime()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 9
c 1
b 0
f 0
nc 1
nop 3
dl 0
loc 14
rs 9.9666
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 Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository;
15
16
class CreditMemoRepository extends EntityRepository implements CreditMemoRepositoryInterface
17
{
18
    public function findByOrderNumberAndDateTime(
19
        int $orderId,
20
        \DateTime $dateTime,
21
        int $amount
22
    ): array {
23
        return $this->createQueryBuilder('o')
24
            ->andWhere('o.order = :orderId')
25
            ->andWhere('o.issuedAt > :issuedAt')
26
            ->andWhere('o.total = :amount')
27
            ->setParameter('orderId', $orderId)
28
            ->setParameter('issuedAt', $dateTime)
29
            ->setParameter('amount', $amount)
30
            ->getQuery()
31
            ->getResult()
32
        ;
33
    }
34
}
35