CategoryManager::save()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Sonata Project package.
7
 *
8
 * (c) Thomas Rabaix <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Sonata\MediaBundle\Model;
15
16
use Sonata\ClassificationBundle\Model\CategoryInterface;
17
use Sonata\ClassificationBundle\Model\CategoryManagerInterface as ManagerInterface;
18
19
/**
20
 * @author Joao Albuquerque <[email protected]>
21
 * @author Christian Gripp <[email protected]>
22
 */
23
final class CategoryManager implements CategoryManagerInterface
24
{
25
    /**
26
     * @var ManagerInterface
27
     */
28
    private $categoryManager;
29
30
    public function __construct(?ManagerInterface $categoryManager = null)
31
    {
32
        $this->categoryManager = $categoryManager;
33
    }
34
35
    public function getRootCategory($context): CategoryInterface
36
    {
37
        return $this->categoryManager->getRootCategory($context);
38
    }
39
40
    public function getRootCategories($loadChildren = true): iterable
41
    {
42
        return $this->categoryManager->getRootCategories($loadChildren);
43
    }
44
45
    public function find($categoryId): ?CategoryInterface
46
    {
47
        return $this->categoryManager->find($categoryId);
48
    }
49
50
    public function findBy(array $criteria): iterable
51
    {
52
        return $this->categoryManager->findBy($criteria);
53
    }
54
55
    public function findOneBy(array $criteria): ?CategoryInterface
56
    {
57
        return $this->categoryManager->findOneBy($criteria);
58
    }
59
60
    public function create(): CategoryInterface
61
    {
62
        return $this->categoryManager->create();
63
    }
64
65
    public function save($category): void
66
    {
67
        $this->categoryManager->save($category);
68
    }
69
}
70