AttributedEntityTrait   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 3
c 2
b 0
f 0
lcom 1
cbo 0
dl 0
loc 41
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A addAttribute() 0 6 1
A removeAttribute() 0 4 1
A getAttributes() 0 4 1
1
<?php
2
3
namespace Padam87\AttributeBundle\Entity;
4
5
use Doctrine\Common\Collections\Collection;
6
use Doctrine\ORM\Mapping as ORM;
7
8
trait AttributedEntityTrait
9
{
10
    /**
11
     * @var Collection
12
     *
13
     * @ORM\ManyToMany(
14
     *     targetEntity="\Padam87\AttributeBundle\Entity\Attribute",
15
     *     fetch="EAGER",
16
     *     cascade={"persist", "remove"}
17
     * )
18
     */
19
    private $attributes;
20
21
    /**
22
     * @param Attribute $attributes
23
     *
24
     * @return $this
25
     */
26
    public function addAttribute(Attribute $attributes)
27
    {
28
        $this->attributes[] = $attributes;
29
30
        return $this;
31
    }
32
33
    /**
34
     * @param Attribute $attributes
35
     */
36
    public function removeAttribute(Attribute $attributes)
37
    {
38
        $this->attributes->removeElement($attributes);
39
    }
40
41
    /**
42
     * @return Collection
43
     */
44
    public function getAttributes()
45
    {
46
        return $this->attributes;
47
    }
48
}
49