Passed
Push — master ( 492dcf...32ce96 )
by Julito
09:05
created

Tool::getResourceNodes()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
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
     * @var string
35
     *
36
     * @ORM\Column(name="image", type="string", length=255, nullable=true, unique=false)
37
     */
38
    protected $image;
39
40
    /**
41
     * @var string
42
     *
43
     * @ORM\Column(name="description", type="text", nullable=true)
44
     */
45
    protected $description;
46
47
    /**
48
     * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\Resource\ResourceType", mappedBy="tool", cascade={"persist", "remove"})
49
     */
50
    protected $resourceTypes;
51
52
    /**
53
     * @return string
54
     */
55
    public function __toString()
56
    {
57
        return (string) $this->getName();
58
    }
59
60
    /**
61
     * @return ArrayCollection
62
     */
63
    public function getToolResourceRight()
64
    {
65
        return $this->toolResourceRight;
66
    }
67
68
    /**
69
     * @param ArrayCollection $toolResourceRight
70
     */
71
    public function setToolResourceRight($toolResourceRight)
72
    {
73
        $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...
74
75
        foreach ($toolResourceRight as $toolResourceRight) {
0 ignored issues
show
introduced by
$toolResourceRight is overwriting one of the parameters of this function.
Loading history...
76
            $this->addToolResourceRight($toolResourceRight);
77
        }
78
    }
79
80
    /**
81
     * @param ToolResourceRight $toolResourceRight
82
     *
83
     * @return $this
84
     */
85
    public function addToolResourceRight(ToolResourceRight $toolResourceRight)
86
    {
87
        $toolResourceRight->setTool($this);
88
        $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...
89
90
        return $this;
91
    }
92
93
    /**
94
     * @return mixed
95
     */
96
    public function getResourceNodes()
97
    {
98
        return $this->resourceNodes;
99
    }
100
101
    /**
102
     * @param mixed $resourceNodes
103
     *
104
     * @return $this
105
     */
106
    public function setResourceNodes($resourceNodes)
107
    {
108
        $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...
109
110
        return $this;
111
    }
112
113
    /**
114
     * Get id.
115
     *
116
     * @return int
117
     */
118
    public function getId(): int
119
    {
120
        return $this->id;
121
    }
122
123
    /**
124
     * Set name.
125
     *
126
     * @param string $name
127
     *
128
     * @return Tool
129
     */
130
    public function setName($name)
131
    {
132
        $this->name = $name;
133
134
        return $this;
135
    }
136
137
    /**
138
     * Get name.
139
     *
140
     * @return string
141
     */
142
    public function getName()
143
    {
144
        return $this->name;
145
    }
146
147
    /**
148
     * Set image.
149
     *
150
     * @param string $image
151
     *
152
     * @return Tool
153
     */
154
    public function setImage($image)
155
    {
156
        $this->image = $image;
157
158
        return $this;
159
    }
160
161
    /**
162
     * Get image.
163
     *
164
     * @return string
165
     */
166
    public function getImage()
167
    {
168
        return $this->image;
169
    }
170
171
    /**
172
     * Set description.
173
     *
174
     * @param string $description
175
     *
176
     * @return Tool
177
     */
178
    public function setDescription($description)
179
    {
180
        $this->description = $description;
181
182
        return $this;
183
    }
184
185
    /**
186
     * Get description.
187
     *
188
     * @return string
189
     */
190
    public function getDescription()
191
    {
192
        return $this->description;
193
    }
194
}
195