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

organizationOfId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 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\Organization\Organization;
19
use Kreta\TaskManager\Domain\Model\Organization\OrganizationId;
20
use Kreta\TaskManager\Domain\Model\Organization\OrganizationRepository;
21
22
class DoctrineORMOrganizationRepository extends EntityRepository implements OrganizationRepository
23
{
24
    public function organizationOfId(OrganizationId $id)
25
    {
26
        return $this->find($id->id());
27
    }
28
29
    public function persist(Organization $organization)
30
    {
31
        $this->getEntityManager()->persist($organization);
32
    }
33
34
    public function remove(Organization $organization)
35
    {
36
        $this->getEntityManager()->remove($organization);
37
    }
38
}
39