Test Failed
Push — master ( dc15ab...6abe5f )
by Szymon
01:26
created

BookReadModel::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Infrastructure\Book\Projection;
6
7
use App\Domain\Common\ValueObject\AggregateRootId;
8
use App\Infrastructure\Book\Query\Projections\BookView;
9
use App\Infrastructure\Common\Query\MysqlRepository;
10
use Doctrine\ORM\EntityManagerInterface;
0 ignored issues
show
Bug introduced by
The type Doctrine\ORM\EntityManagerInterface 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...
11
12
class BookReadModel extends MysqlRepository
13
{
14
    public function add(BookView $postView): void
15
    {
16
        $this->register($postView);
17
    }
18
19
    /**
20
     * @throws \Doctrine\ORM\NonUniqueResultException
21
     */
22
    public function oneByUuid(AggregateRootId $id)
23
    {
24
        $qb = $this->repository
25
            ->createQueryBuilder('book')
26
            ->where('book.id = :id')
27
            ->setParameter('id', $id->toString());
28
29
        return $this->oneOrException($qb);
30
    }
31
32
    public function delete(string $id)
33
    {
34
        $post = $this->repository->find($id);
35
        $this->entityManager->remove($post);
36
        $this->entityManager->flush();
37
    }
38
39
    /**
40
     * MysqlUserReadModelRepository constructor.
41
     */
42
    public function __construct(EntityManagerInterface $entityManager)
43
    {
44
        $this->class = BookView::class;
45
        parent::__construct($entityManager);
46
    }
47
}
48