LogEntryRepository::createByOwnerIdQueryBuilder()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
nc 1
nop 1
dl 0
loc 8
rs 10
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Setono\SyliusLogEntryPlugin\Doctrine\ORM;
6
7
use Doctrine\ORM\QueryBuilder;
8
use Setono\SyliusLogEntryPlugin\Repository\LogEntryRepositoryInterface;
9
use Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository;
10
use Webmozart\Assert\Assert;
11
12
class LogEntryRepository extends EntityRepository implements LogEntryRepositoryInterface
13
{
14
    public function createByOwnerIdQueryBuilder($id): QueryBuilder
15
    {
16
        Assert::scalar($id);
17
18
        return $this->createQueryBuilder('o')
19
            ->innerJoin('o.owner', 'owner')
20
            ->andWhere('owner.id = :id')
21
            ->setParameter('id', $id)
22
            ;
23
    }
24
}
25