Completed
Push — master ( 3a76aa...76046e )
by Julito
07:47
created

CExerciseCategory::setCourse()   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
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 5
rs 10
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
     */
45
    //protected $course;
46
47
    /**
48
     * @var Course
49
     *
50
     * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Course")
51
     * @ORM\JoinColumn(name="c_id", referencedColumnName="id", nullable=false)
52
     */
53
    protected $course;
54
55
    /**
56
     * @var string
57
     *
58
     * @ORM\Column(name="name", type="string", length=255, nullable=false)
59
     */
60
    protected $name;
61
62
    /**
63
     * @var string
64
     *
65
     * @ORM\Column(name="description", type="text", nullable=true)
66
     */
67
    protected $description;
68
69
    /**
70
     * @Gedmo\SortablePosition
71
     *
72
     * @ORM\Column(name="position", type="integer")
73
     */
74
    protected $position;
75
76
    /**
77
     * Project constructor.
78
     */
79
    public function __construct()
80
    {
81
    }
82
83
    /**
84
     * @return int
85
     */
86
    public function getId()
87
    {
88
        return $this->id;
89
    }
90
91
    /**
92
     * @param int $id
93
     *
94
     * @return CExerciseCategory
95
     */
96
    public function setId($id)
97
    {
98
        $this->id = $id;
99
100
        return $this;
101
    }
102
103
    /**
104
     * @return string
105
     */
106
    public function getName()
107
    {
108
        return $this->name;
109
    }
110
111
    /**
112
     * @param string $name
113
     *
114
     * @return CExerciseCategory
115
     */
116
    public function setName($name)
117
    {
118
        $this->name = $name;
119
120
        return $this;
121
    }
122
123
    /**
124
     * @return string
125
     */
126
    public function getDescription()
127
    {
128
        return $this->description;
129
    }
130
131
    /**
132
     * @param string $description
133
     *
134
     * @return CExerciseCategory
135
     */
136
    public function setDescription($description)
137
    {
138
        $this->description = $description;
139
140
        return $this;
141
    }
142
143
    /**
144
     * @return Course
145
     */
146
    public function getCourse()
147
    {
148
        return $this->course;
149
    }
150
151
    /**
152
     * @param Course $course
153
     *
154
     * @return CExerciseCategory
155
     */
156
    public function setCourse(Course $course): CExerciseCategory
157
    {
158
        $this->course = $course;
159
160
        return $this;
161
    }
162
163
    /**
164
     * @return mixed
165
     */
166
    public function getPosition()
167
    {
168
        return $this->position;
169
    }
170
171
    /**
172
     * @param mixed $position
173
     *
174
     * @return CExerciseCategory
175
     */
176
    public function setPosition($position)
177
    {
178
        $this->position = $position;
179
180
        return $this;
181
    }
182
183
    /**
184
     * Resource identifier.
185
     *
186
     * @return int
187
     */
188
    public function getResourceIdentifier(): int
189
    {
190
        return $this->getId();
191
    }
192
193
    /**
194
     * @return string
195
     */
196
    public function getResourceName(): string
197
    {
198
        return $this->getName();
199
    }
200
}
201