Completed
Pull Request — master (#174)
by Gorka
05:28 queued 59s
created

DoctrineORMTaskRepository   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 3
dl 0
loc 17
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A taskOfId() 0 4 1
A persist() 0 4 1
A remove() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the Kreta package.
5
 *
6
 * (c) Beñat Espiña <[email protected]>
7
 * (c) Gorka Laucirica <[email protected]>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
declare(strict_types=1);
14
15
namespace Kreta\TaskManager\Infrastructure\Persistence\ORM\Organization;
16
17
use Doctrine\ORM\EntityRepository;
18
use Kreta\TaskManager\Domain\Model\Project\Task\Task;
19
use Kreta\TaskManager\Domain\Model\Project\Task\TaskId;
20
use Kreta\TaskManager\Domain\Model\Project\Task\TaskRepository;
21
22
class DoctrineORMTaskRepository extends EntityRepository implements TaskRepository
23
{
24
    public function taskOfId(TaskId $id)
25
    {
26
        return $this->find($id->id());
27
    }
28
29
    public function persist(Task $task)
30
    {
31
        $this->getEntityManager()->persist($task);
32
    }
33
34
    public function remove(Task $task)
35
    {
36
        $this->getEntityManager()->remove($task);
37
    }
38
}
39