AttributedEntityTrait::getAttributes()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
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