TransactionalUuidCrudRepository   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 25
c 0
b 0
f 0
wmc 2
lcom 0
cbo 3
ccs 10
cts 10
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A findByUuid() 0 10 1
A createFindByUuidQuery() 0 8 1
1
<?php
2
3
namespace Dontdrinkandroot\Repository;
4
5
use Doctrine\ORM\Query;
6
7
/**
8
 * @author Philip Washington Sorst <[email protected]>
9
 */
10
class TransactionalUuidCrudRepository extends TransactionalCrudRepository implements UuidCrudRepositoryInterface
0 ignored issues
show
Bug introduced by
There is one abstract method getClassName in this class; you could implement it, or declare this class as abstract.
Loading history...
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15 6
    public function findByUuid(string $uuid): ?object
16
    {
17 6
        return $this->getTransactionManager()->transactional(
18
            function () use ($uuid) {
19 6
                $query = $this->createFindByUuidQuery($uuid);
20
21 6
                return $query->getOneOrNullResult();
22 6
            }
23
        );
24
    }
25
26 6
    protected function createFindByUuidQuery(string $uuid): Query
27
    {
28 6
        $queryBuilder = $this->createQueryBuilder('entity');
0 ignored issues
show
Bug introduced by
The method createQueryBuilder() does not seem to exist on object<Dontdrinkandroot\...onalUuidCrudRepository>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
29 6
        $queryBuilder->where('entity.uuid = :uuid');
30 6
        $queryBuilder->setParameter('uuid', $uuid);
31
32 6
        return $queryBuilder->getQuery();
33
    }
34
}
35