Total Complexity | 9 |
Total Lines | 61 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
9 | class GroupManager extends BaseGroupManager |
||
10 | { |
||
11 | /** |
||
12 | * @var ObjectManager |
||
13 | */ |
||
14 | private $objectManager; |
||
15 | |||
16 | /** |
||
17 | * @var string |
||
18 | */ |
||
19 | private $class; |
||
20 | |||
21 | 7 | public function __construct( |
|
22 | ObjectManager $objectManager, |
||
23 | $class |
||
24 | ) |
||
25 | { |
||
26 | 7 | $this->objectManager = $objectManager; |
|
27 | 7 | $this->class = $class; |
|
28 | } |
||
29 | |||
30 | 1 | public function deleteGroup(GroupInterface $group) |
|
31 | { |
||
32 | 1 | $this->objectManager->remove($group); |
|
33 | 1 | $this->objectManager->flush(); |
|
34 | } |
||
35 | |||
36 | 6 | public function findGroupBy(array $criteria) |
|
37 | { |
||
38 | 6 | return $this->getRepository()->findOneBy($criteria); |
|
39 | } |
||
40 | |||
41 | 1 | public function findGroups() |
|
42 | { |
||
43 | 1 | return $this->getRepository()->findAll(); |
|
44 | } |
||
45 | |||
46 | /** |
||
47 | * {@inheritdoc} |
||
48 | */ |
||
49 | 8 | public function getClass() |
|
50 | { |
||
51 | 8 | if (false !== strpos($this->class, ':')) { |
|
52 | 1 | $metadata = $this->objectManager->getClassMetadata($this->class); |
|
53 | 1 | $this->class = $metadata->getName(); |
|
54 | } |
||
55 | |||
56 | 8 | return $this->class; |
|
57 | } |
||
58 | |||
59 | 5 | public function updateGroup(GroupInterface $group, $andFlush = true) |
|
64 | } |
||
65 | } |
||
66 | |||
67 | 7 | public function getRepository() |
|
70 | } |
||
71 | } |
||
72 |