OrderRepository::findOneByExternalId()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 2
c 1
b 0
f 1
nc 1
nop 1
dl 0
loc 6
ccs 0
cts 4
cp 0
crap 2
rs 10
1
<?php
2
3
namespace Loevgaard\DandomainFoundation\Repository;
4
5
use Loevgaard\DandomainFoundation\Entity\Generated\OrderInterface;
0 ignored issues
show
Bug introduced by
The type Loevgaard\DandomainFound...enerated\OrderInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Loevgaard\DandomainFoundation\Entity\Order;
7
use Loevgaard\DandomainFoundation\Repository\Generated\OrderRepositoryTrait;
0 ignored issues
show
Bug introduced by
The type Loevgaard\DandomainFound...ed\OrderRepositoryTrait was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use Symfony\Bridge\Doctrine\RegistryInterface;
9
10
/**
11
 * @method null|OrderInterface find($id)
12
 * @method OrderInterface[]    findBy(array $criteria, array $orderBy = null, int $limit = null, int $offset = null)
13
 * @method null|OrderInterface findOneBy(array $criteria)
14
 * @method OrderInterface[]    findAll()
15
 */
16
class OrderRepository extends AbstractRepository
17
{
18
    use OrderRepositoryTrait;
19
20
    public function __construct(RegistryInterface $registry)
21
    {
22
        parent::__construct($registry, Order::class);
0 ignored issues
show
Bug introduced by
$registry of type Symfony\Bridge\Doctrine\RegistryInterface is incompatible with the type Doctrine\Common\Persistence\ManagerRegistry expected by parameter $registry of Loevgaard\DandomainFound...pository::__construct(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

22
        parent::__construct(/** @scrutinizer ignore-type */ $registry, Order::class);
Loading history...
23
    }
24
25
    public function findOneByExternalId(int $externalId): ?OrderInterface
26
    {
27
        /** @var OrderInterface $obj */
28
        $obj = $this->_findOneByExternalId($externalId);
29
30
        return $obj;
31
    }
32
33
    /**
34
     * @param \DateTimeInterface $start
35
     * @param \DateTimeInterface $end
36
     * @return OrderInterface[]
37
     */
38
    public function findByInterval(\DateTimeInterface $start, \DateTimeInterface $end)
39
    {
40
        $qb = $this->createQueryBuilder('o');
41
        $qb->where($qb->expr()->between('o.createdAt', ':start', ':end'))
42
            ->setParameters([
43
                'start' => $start,
44
                'end' => $end
45
            ])
46
        ;
47
48
        return $qb->getQuery()->getResult();
49
    }
50
}
51