UnitRepository   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A add() 0 5 1
A findById() 0 4 1
A update() 0 5 1
1
<?php
2
3
namespace AppBundle\Repository;
4
5
use Doctrine\ORM\EntityRepository;
6
use Domain\Unit\Enitity\UnitInterface;
7
use Domain\Unit\Repository\UnitRepositoryInterface;
8
9
/**
10
 * UnitRepository
11
 *
12
 * This class was generated by the Doctrine ORM. Add your own custom
13
 * repository methods below.
14
 */
15
class UnitRepository extends EntityRepository implements UnitRepositoryInterface
16
{
17
    /**
18
     * @param UnitInterface $unit
19
     * @return void
20
     */
21
    public function add(UnitInterface $unit)
22
    {
23
        $this->_em->persist($unit);
24
        $this->_em->flush();
25
    }
26
27
    /**
28
     * @param integer $id
29
     * @return UnitInterface|null
30
     */
31
    public function findById($id)
32
    {
33
        return $this->findOneBy(['id' => $id]);
34
    }
35
36
    /**
37
     * @param UnitInterface $unit
38
     * @return void
39
     */
40
    public function update(UnitInterface $unit)
41
    {
42
        $this->_em->persist($unit);
43
        $this->_em->flush();
44
    }
45
}
46