Manager   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A getManager() 0 4 1
A flush() 0 4 1
1
<?php
2
3
namespace Black\Bridge\Doctrine\Common;
4
5
use Doctrine\Common\Persistence\ObjectManager;
6
7
/**
8
 * Class Manager
9
 */
10
abstract class Manager
11
{
12
    /**
13
     * @var ObjectManager
14
     */
15
    protected $manager;
16
17
    /**
18
     * @var \Doctrine\Common\Persistence\ObjectRepository
19
     */
20
    protected $repository;
21
22
    /**
23
     * @var string
24
     */
25
    protected $class;
26
27
    /**
28
     * @param ObjectManager $manager
29
     * @param $class
30
     */
31
    public function __construct(ObjectManager $manager, $class)
32
    {
33
        $this->manager = $manager;
34
        $this->repository = $manager->getRepository($class);
35
        $metadata = $manager->getClassMetadata($class);
36
        $this->class = $metadata->getName();
37
    }
38
39
    /**
40
     * @return ObjectManager
41
     */
42
    public function getManager()
43
    {
44
        return $this->manager;
45
    }
46
47
    /**
48
     * @return mixed|void
49
     */
50
    public function flush()
51
    {
52
        $this->manager->flush();
53
    }
54
}
55