Completed
Push — master ( 8c4b64...5794aa )
by Philip
02:36
created

DelegatedCrudService::createAssociation()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 3
crap 2
1
<?php
2
3
namespace Dontdrinkandroot\Service;
4
5
use Doctrine\ORM\Tools\Pagination\Paginator;
6
7
class DelegatedCrudService implements CrudServiceInterface
8
{
9
    /**
10
     * @var CrudServiceInterface
11
     */
12
    private $delegate;
13
14
    public function __construct(CrudServiceInterface $delegate)
15
    {
16
        $this->delegate = $delegate;
17
    }
18
19
    /**
20
     * {@inheritdoc}
21
     */
22
    public function find($id)
23
    {
24
        return $this->delegate->find($id);
25
    }
26
27
    /**
28
     * {@inheritdoc}
29
     */
30
    public function findAll()
31
    {
32
        return $this->delegate->findAll();
33
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38
    public function findAllPaginated(int $page = 1, int $perPage = 50): Paginator
39
    {
40
        return $this->delegate->findAllPaginated($page, $perPage);
41
    }
42
43
    /**
44
     * {@inheritdoc}
45
     */
46
    public function create($entity)
47
    {
48
        return $this->delegate->create($entity);
49
    }
50
51
    /**
52
     * {@inheritdoc}
53
     */
54
    public function update($entity)
55
    {
56
        return $this->delegate->update($entity);
57
    }
58
59
    /**
60
     * {@inheritdoc}
61
     */
62
    public function remove($entity)
63
    {
64
        $this->delegate->remove($entity);
65
    }
66
67
    /**
68
     * {@inheritdoc}
69
     */
70
    public function findAssociationPaginated($entity, string $association, int $page = 1, $perPage = 50)
71
    {
72
        return $this->delegate->findAssociationPaginated($entity, $association, $page, $perPage);
73
    }
74
75
    /**
76
     * {@inheritdoc}
77
     */
78
    public function createAssociation($entity, string $fieldName, $child)
79
    {
80
        return $this->delegate->createAssociation($entity, $fieldName, $child);
81
    }
82
83
    /**
84
     * {@inheritdoc}
85
     */
86
    public function addAssociation($entity, string $fieldName, $id)
87
    {
88
        $this->delegate->addAssociation($entity, $fieldName, $id);
89
    }
90
91
    /**
92
     * {@inheritdoc}
93
     */
94
    public function removeAssociation($entity, string $fieldName, $id = null)
95
    {
96
        $this->delegate->removeAssociation($entity, $fieldName, $id);
97
    }
98
99
    /**
100
     * @return CrudServiceInterface
101
     */
102
    protected function getDelegate()
103
    {
104
        return $this->delegate;
105
    }
106
}
107