Test Failed
Push — master ( 6abe5f...23903e )
by Szymon
01:28
created

BookMysqlRepository::add()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

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