Completed
Push — master ( db9c88...be5baf )
by Julito
14:58
created

CExerciseCategory::__toString()   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
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
nc 1
1
<?php
2
3
/* For licensing terms, see /license.txt */
4
5
namespace Chamilo\CourseBundle\Entity;
6
7
use Chamilo\CoreBundle\Entity\AbstractResource;
8
use Chamilo\CoreBundle\Entity\Course;
9
use Chamilo\CoreBundle\Entity\ResourceInterface;
10
use Doctrine\ORM\Mapping as ORM;
11
use Gedmo\Mapping\Annotation as Gedmo;
12
use Gedmo\Timestampable\Traits\TimestampableEntity;
13
use Symfony\Component\Validator\Constraints as Assert;
14
15
/**
16
 * CExerciseCategory.
17
 *
18
 * @ORM\Table(name="c_exercise_category")
19
 * @ORM\Entity(repositoryClass="Gedmo\Sortable\Entity\Repository\SortableRepository")
20
 */
21
class CExerciseCategory extends AbstractResource implements ResourceInterface
22
{
23
    use TimestampableEntity;
24
25
    /**
26
     * @var int
27
     *
28
     * @ORM\Column(name="id", type="bigint")
29
     * @ORM\Id
30
     * @ORM\GeneratedValue
31
     */
32
    protected $id;
33
34
    /**
35
     * @var Course
36
     *
37
     * Gedmo\SortableGroup
38
     *
39
     * ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CExerciseCategory", inversedBy="children")
40
     * ORM\JoinColumn(referencedColumnName="id", onDelete="SET NULL")
41
     */
42
    //protected $course;
43
44
    /**
45
     * @var Course
46
     *
47
     * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Course")
48
     * @ORM\JoinColumn(name="c_id", referencedColumnName="id", nullable=false)
49
     */
50
    protected $course;
51
52
    /**
53
     * @var string
54
     *
55
     * @Assert\NotBlank
56
     *
57
     * @ORM\Column(name="name", type="string", length=255, nullable=false)
58
     */
59
    protected $name;
60
61
    /**
62
     * @var string
63
     *
64
     * @ORM\Column(name="description", type="text", nullable=true)
65
     */
66
    protected $description;
67
68
    /**
69
     * @Gedmo\SortablePosition
70
     *
71
     * @ORM\Column(name="position", type="integer")
72
     */
73
    protected $position;
74
75
    /**
76
     * Project constructor.
77
     */
78
    public function __construct()
79
    {
80
    }
81
82
    public function __toString(): string
83
    {
84
        return (string) $this->getName();
85
    }
86
87
    /**
88
     * @return int
89
     */
90
    public function getId()
91
    {
92
        return $this->id;
93
    }
94
95
    /**
96
     * @param int $id
97
     *
98
     * @return CExerciseCategory
99
     */
100
    public function setId($id)
101
    {
102
        $this->id = $id;
103
104
        return $this;
105
    }
106
107
    /**
108
     * @return string
109
     */
110
    public function getName()
111
    {
112
        return (string) $this->name;
113
    }
114
115
    /**
116
     * @param string $name
117
     *
118
     * @return CExerciseCategory
119
     */
120
    public function setName($name)
121
    {
122
        $this->name = $name;
123
124
        return $this;
125
    }
126
127
    /**
128
     * @return string
129
     */
130
    public function getDescription()
131
    {
132
        return $this->description;
133
    }
134
135
    /**
136
     * @param string $description
137
     *
138
     * @return CExerciseCategory
139
     */
140
    public function setDescription($description)
141
    {
142
        $this->description = $description;
143
144
        return $this;
145
    }
146
147
    /**
148
     * @return Course
149
     */
150
    public function getCourse()
151
    {
152
        return $this->course;
153
    }
154
155
    public function setCourse(Course $course): self
156
    {
157
        $this->course = $course;
158
159
        return $this;
160
    }
161
162
    public function getPosition()
163
    {
164
        return $this->position;
165
    }
166
167
    /**
168
     * @return CExerciseCategory
169
     */
170
    public function setPosition($position)
171
    {
172
        $this->position = $position;
173
174
        return $this;
175
    }
176
177
    /**
178
     * Resource identifier.
179
     */
180
    public function getResourceIdentifier(): int
181
    {
182
        return $this->getId();
183
    }
184
185
    public function getResourceName(): string
186
    {
187
        return $this->getName();
188
    }
189
190
    public function setResourceName(string $name): self
191
    {
192
        return $this->setName($name);
193
    }
194
}
195