ResourceElement   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
eloc 5
c 2
b 0
f 0
dl 0
loc 13
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A save() 0 4 1
A getResourceValueRepository() 0 3 1
1
<?php
2
3
/**
4
 * (c) FSi sp. z o.o. <[email protected]>
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
declare(strict_types=1);
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();
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->getRepository() returns the type Doctrine\Common\Persistence\ObjectRepository which is incompatible with the type-hinted return FSi\Bundle\ResourceRepos...ResourceValueRepository.
Loading history...
25
    }
26
27
    public function save(ResourceValue $resource): void
28
    {
29
        $this->getObjectManager()->persist($resource);
30
        $this->getObjectManager()->flush();
31
    }
32
}
33