Completed
Push — master ( cbf730...0a6a4f )
by Julito
18:04 queued 08:12
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
/* For licensing terms, see /license.txt */
3
4
namespace Chamilo\CourseBundle\Entity;
5
6
use APY\DataGridBundle\Grid\Mapping as GRID;
7
use Chamilo\CoreBundle\Entity\Course;
8
use Chamilo\CoreBundle\Entity\Resource\AbstractResource;
9
use Chamilo\CoreBundle\Entity\Resource\ResourceInterface;
10
use Doctrine\ORM\Mapping as ORM;
11
use Gedmo\Mapping\Annotation as Gedmo;
12
use Gedmo\Timestampable\Traits\TimestampableEntity;
13
14
/**
15
 * CExerciseCategory.
16
 *
17
 * @ORM\Table(name="c_exercise_category")
18
 *
19
 * @ORM\Entity(repositoryClass="Gedmo\Sortable\Entity\Repository\SortableRepository")
20
 *
21
 * @GRID\Source(columns="id, name")
22
 */
23
class CExerciseCategory extends AbstractResource implements ResourceInterface
24
{
25
    use TimestampableEntity;
26
27
    /**
28
     * @var int
29
     *
30
     * @ORM\Column(name="id", type="bigint")
31
     * @ORM\Id
32
     * @ORM\GeneratedValue
33
     */
34
    protected $id;
35
36
    /**
37
     * @var Course
38
     *
39
     * Gedmo\SortableGroup
40
     *
41
     * ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CExerciseCategory", inversedBy="children")
42
     * ORM\JoinColumn(referencedColumnName="id", onDelete="SET NULL")
43
     */
44
    //protected $course;
45
46
    /**
47
     * @var Course
48
     *
49
     * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Course")
50
     * @ORM\JoinColumn(name="c_id", referencedColumnName="id", nullable=false)
51
     */
52
    protected $course;
53
54
    /**
55
     * @var string
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
    /**
83
     * @return string
84
     */
85
    public function __toString(): string
86
    {
87
        return (string) $this->getName();
88
    }
89
90
    /**
91
     * @return int
92
     */
93
    public function getId()
94
    {
95
        return $this->id;
96
    }
97
98
    /**
99
     * @param int $id
100
     *
101
     * @return CExerciseCategory
102
     */
103
    public function setId($id)
104
    {
105
        $this->id = $id;
106
107
        return $this;
108
    }
109
110
    /**
111
     * @return string
112
     */
113
    public function getName()
114
    {
115
        return $this->name;
116
    }
117
118
    /**
119
     * @param string $name
120
     *
121
     * @return CExerciseCategory
122
     */
123
    public function setName($name)
124
    {
125
        $this->name = $name;
126
127
        return $this;
128
    }
129
130
    /**
131
     * @return string
132
     */
133
    public function getDescription()
134
    {
135
        return $this->description;
136
    }
137
138
    /**
139
     * @param string $description
140
     *
141
     * @return CExerciseCategory
142
     */
143
    public function setDescription($description)
144
    {
145
        $this->description = $description;
146
147
        return $this;
148
    }
149
150
    /**
151
     * @return Course
152
     */
153
    public function getCourse()
154
    {
155
        return $this->course;
156
    }
157
158
    public function setCourse(Course $course): CExerciseCategory
159
    {
160
        $this->course = $course;
161
162
        return $this;
163
    }
164
165
    /**
166
     * @return mixed
167
     */
168
    public function getPosition()
169
    {
170
        return $this->position;
171
    }
172
173
    /**
174
     * @param mixed $position
175
     *
176
     * @return CExerciseCategory
177
     */
178
    public function setPosition($position)
179
    {
180
        $this->position = $position;
181
182
        return $this;
183
    }
184
185
    /**
186
     * Resource identifier.
187
     */
188
    public function getResourceIdentifier(): int
189
    {
190
        return $this->getId();
191
    }
192
193
    public function getResourceName(): string
194
    {
195
        return $this->getName();
196
    }
197
}
198