Completed
Push — master ( d28136...3a5b5f )
by Julito
16:58
created

CExerciseCategory::getResourceFieldName()   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
c 0
b 0
f 0
nop 0
dl 0
loc 3
rs 10
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", filterable=false)
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
    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): CExerciseCategory
156
    {
157
        $this->course = $course;
158
159
        return $this;
160
    }
161
162
    /**
163
     * @return mixed
164
     */
165
    public function getPosition()
166
    {
167
        return $this->position;
168
    }
169
170
    /**
171
     * @param mixed $position
172
     *
173
     * @return CExerciseCategory
174
     */
175
    public function setPosition($position)
176
    {
177
        $this->position = $position;
178
179
        return $this;
180
    }
181
182
    /**
183
     * Resource identifier.
184
     */
185
    public function getResourceIdentifier(): int
186
    {
187
        return $this->getId();
188
    }
189
190
    public function getResourceName(): string
191
    {
192
        return $this->getName();
193
    }
194
}
195