Attribute::getDefinition()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 4
Bugs 0 Features 0
Metric Value
c 4
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\ORM\Mapping as ORM;
6
7
/**
8
 * @ORM\Entity()
9
 * @ORM\Table("attribute")
10
 */
11
class Attribute
12
{
13
    /**
14
     * @var int
15
     *
16
     * @ORM\Id
17
     * @ORM\Column(type="integer")
18
     * @ORM\GeneratedValue(strategy="AUTO")
19
     */
20
    private $id;
21
22
    /**
23
     * @var string
24
     *
25
     * @ORM\Column(type="string", length=255, nullable=true)
26
     */
27
    private $value;
28
29
    /**
30
     * @var Definition
31
     *
32
     * @ORM\ManyToOne(targetEntity="Definition", inversedBy="attributes")
33
     * @ORM\JoinColumn(name="definition_id", referencedColumnName="id", nullable=false)
34
     */
35
    private $definition;
36
37
    /**
38
     * @return string
39
     */
40
    public function __toString()
41
    {
42
        return $this->getDefinition()->getName();
43
    }
44
45
    /**
46
     * @return integer
47
     */
48
    public function getId()
49
    {
50
        return $this->id;
51
    }
52
53
    /**
54
     * @param string $value
55
     *
56
     * @return Attribute
57
     */
58
    public function setValue($value)
59
    {
60
        $this->value = $value;
61
62
        return $this;
63
    }
64
65
    /**
66
     * @return string
67
     */
68
    public function getValue()
69
    {
70
        return $this->value;
71
    }
72
73
    /**
74
     * @param Definition $definition
75
     *
76
     * @return Attribute
77
     */
78
    public function setDefinition(Definition $definition = null)
79
    {
80
        $this->definition = $definition;
81
82
        return $this;
83
    }
84
85
    /**
86
     * @return Definition
87
     */
88
    public function getDefinition()
89
    {
90
        return $this->definition;
91
    }
92
}
93