Completed
Pull Request — master (#311)
by Łukasz
05:40
created

ResourceElement   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 15
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getResourceValueRepository() 0 4 1
A save() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * (c) FSi sp. z o.o. <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace FSi\Bundle\AdminBundle\Doctrine\Admin;
13
14
use FSi\Bundle\AdminBundle\Admin\ResourceRepository\GenericResourceElement;
15
use FSi\Bundle\ResourceRepositoryBundle\Model\ResourceValue;
16
use FSi\Bundle\ResourceRepositoryBundle\Model\ResourceValueRepository;
17
18
abstract class ResourceElement extends GenericResourceElement implements Element
19
{
20
    use ElementImpl;
21
22
    public function getResourceValueRepository(): ResourceValueRepository
23
    {
24
        return $this->getRepository();
25
    }
26
27
    public function save(ResourceValue $resource): void
28
    {
29
        $this->getObjectManager()->persist($resource);
30
        $this->getObjectManager()->flush();
31
    }
32
}
33