Completed
Push — master ( 76efa7...03cf40 )
by Julito
12:18
created

Tool::setDescription()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
/* For licensing terms, see /license.txt */
3
4
namespace Chamilo\CoreBundle\Entity;
5
6
use Doctrine\Common\Collections\ArrayCollection;
7
use Doctrine\ORM\Mapping as ORM;
8
9
/**
10
 * Tool.
11
 *
12
 * @ORM\Table(name="tool")
13
 * @ORM\Entity
14
 */
15
class Tool
16
{
17
    /**
18
     * @var int
19
     *
20
     * @ORM\Column(name="id", type="integer", nullable=false, unique=false)
21
     * @ORM\Id
22
     * @ORM\GeneratedValue
23
     */
24
    protected $id;
25
26
    /**
27
     * @var string
28
     *
29
     * @ORM\Column(name="name", type="string", nullable=false, unique=false)
30
     */
31
    protected $name;
32
33
    /**
34
     * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\Resource\ResourceType", mappedBy="tool", cascade={"persist", "remove"})
35
     */
36
    protected $resourceTypes;
37
38
    /**
39
     * @return string
40
     */
41
    public function __toString()
42
    {
43
        return (string) $this->getName();
44
    }
45
46
    /**
47
     * @return ArrayCollection
48
     */
49
    public function getToolResourceRight()
50
    {
51
        return $this->toolResourceRight;
52
    }
53
54
    /**
55
     * @param ArrayCollection $toolResourceRight
56
     */
57
    public function setToolResourceRight($toolResourceRight)
58
    {
59
        $this->toolResourceRight = new ArrayCollection();
0 ignored issues
show
Bug Best Practice introduced by
The property toolResourceRight does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
60
61
        foreach ($toolResourceRight as $item) {
62
            $this->addToolResourceRight($item);
63
        }
64
    }
65
66
    /**
67
     * @return $this
68
     */
69
    public function addToolResourceRight(ToolResourceRight $toolResourceRight)
70
    {
71
        $toolResourceRight->setTool($this);
72
        $this->toolResourceRight[] = $toolResourceRight;
0 ignored issues
show
Bug Best Practice introduced by
The property toolResourceRight does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
73
74
        return $this;
75
    }
76
77
    /**
78
     * @return mixed
79
     */
80
    public function getResourceNodes()
81
    {
82
        return $this->resourceNodes;
83
    }
84
85
    /**
86
     * @param mixed $resourceNodes
87
     *
88
     * @return $this
89
     */
90
    public function setResourceNodes($resourceNodes)
91
    {
92
        $this->resourceNodes = $resourceNodes;
0 ignored issues
show
Bug Best Practice introduced by
The property resourceNodes does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
93
94
        return $this;
95
    }
96
97
    /**
98
     * Get id.
99
     */
100
    public function getId(): int
101
    {
102
        return $this->id;
103
    }
104
105
    /**
106
     * Set name.
107
     *
108
     * @param string $name
109
     *
110
     * @return Tool
111
     */
112
    public function setName($name)
113
    {
114
        $this->name = $name;
115
116
        return $this;
117
    }
118
119
    /**
120
     * Get name.
121
     *
122
     * @return string
123
     */
124
    public function getName()
125
    {
126
        return $this->name;
127
    }
128
}
129