Completed
Push — master ( 6344ea...94fc66 )
by Julito
177:56 queued 121:43
created

ExtraFieldValues::setExtraField()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 6
rs 9.4285
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\ORM\Mapping as ORM;
7
use Gedmo\Mapping\Annotation as Gedmo;
8
use Sylius\Component\Attribute\Model\AttributeInterface;
9
use Sylius\Component\Attribute\Model\AttributeSubjectInterface;
10
use Sylius\Component\Attribute\Model\AttributeValueInterface;
11
12
/**
13
 * Class ExtraFieldValues
14
 * @todo change entity name to ExtraFieldValue
15
 * @ORM\Table(name="extra_field_values")
16
 * @ORM\Entity(repositoryClass="Chamilo\CoreBundle\Entity\Repository\ExtraFieldValuesRepository")
17
 */
18
class ExtraFieldValues implements AttributeValueInterface
19
{
20
    /**
21
     * @var integer
22
     *
23
     * @ORM\Column(name="id", type="integer", nullable=false, unique=false)
24
     * @ORM\Id
25
     * @ORM\GeneratedValue()
26
     */
27
    protected $id;
28
29
    /**
30
     * @var string
31
     * @ORM\Column(name="value", type="string", nullable=true, unique=false)
32
     */
33
    protected $value;
34
35
    /**
36
     * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\ExtraField")
37
     * @ORM\JoinColumn(name="field_id", referencedColumnName="id")
38
     **/
39
    protected $field;
40
41
    /**
42
     * @var ExtraField
43
     *
44
     * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\ExtraField")
45
     * @ORM\JoinColumn(name="field_id", referencedColumnName="id")
46
     **/
47
    protected $attribute;
48
49
    /**
50
     * @var string
51
     * @ORM\Column(name="item_id", type="integer", nullable=false, unique=false)
52
     */
53
    protected $itemId;
54
55
    /**
56
     * @var string
57
     * @ORM\Column(name="comment", type="text", nullable=true, unique=false)
58
     */
59
    protected $comment;
60
61
    /**
62
     * @ORM\ManyToOne(targetEntity="Chamilo\UserBundle\Entity\User", cascade={"persist"}, inversedBy="extraFields")
63
     * @ORM\JoinColumn(name="item_id", referencedColumnName="id")
64
     */
65
    protected $user;
66
67
    /**
68
     * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Course", cascade={"persist"}, inversedBy="extraFields")
69
     * @ORM\JoinColumn(name="item_id", referencedColumnName="id")
70
     */
71
    //protected $course;
72
73
    /**
74
     * @var \DateTime $created
75
     *
76
     * @Gedmo\Timestampable(on="create")
77
     * @ORM\Column(name="created_at", type="datetime")
78
     */
79
    protected $createdAt;
80
81
    /**
82
     * @var \DateTime $updated
83
     *
84
     * @Gedmo\Timestampable(on="update")
85
     * @ORM\Column(name="updated_at", type="datetime")
86
     */
87
    protected $updatedAt;
88
89
    /**
90
     * Constructor
91
     */
92
    public function __construct()
93
    {
94
    }
95
96
    /**
97
     * Get id
98
     *
99
     * @return integer
100
     */
101
    public function getId()
102
    {
103
        return $this->id;
104
    }
105
106
    public function getName()
107
    {
108
        return $this->getExtraField()->getDisplayText();
109
    }
110
111
    /**
112
     * @return string
113
     */
114
    public function getType()
115
    {
116
        return $this->getExtraField()->getTypeToString();
117
    }
118
119
    /**
120
     * @return ExtraField
121
     */
122
    public function getExtraField()
123
    {
124
        return $this->getField();
125
    }
126
127
    /**
128
     * @param mixed $field
129
     *
130
     * @return ExtraFieldValues
131
     */
132
    public function setExtraField(ExtraField $field)
133
    {
134
        $this->setField($field);
135
136
        return $this;
137
    }
138
139
    public function setUser($user)
140
    {
141
        $this->user = $user;
142
    }
143
144
    /**
145
     * @return mixed
146
     */
147
    public function getField()
148
    {
149
        return $this->field;
150
    }
151
152
    /**
153
     * @param mixed $field
154
     *
155
     * @return ExtraFieldValues
156
     */
157
    public function setField($field)
158
    {
159
        $this->field = $field;
160
161
        return $this;
162
    }
163
164
    /**
165
     * @return string
166
     */
167
    public function getItemId()
168
    {
169
        return $this->itemId;
170
    }
171
172
    /**
173
     * @param string $itemId
174
     *
175
     * @return ExtraFieldValues
176
     */
177
    public function setItemId($itemId)
178
    {
179
        $this->itemId = $itemId;
180
181
        return $this;
182
    }
183
184
    /**
185
     * @return \DateTime
186
     */
187
    public function getCreatedAt()
188
    {
189
        return $this->createdAt;
190
    }
191
192
    /**
193
     * @param \DateTime $createdAt
194
     *
195
     * @return $this
196
     */
197
    public function setCreatedAt($createdAt)
198
    {
199
        $this->createdAt = $createdAt;
200
201
        return $this;
202
    }
203
204
    /**
205
     * @return \DateTime
206
     */
207
    public function getUpdatedAt()
208
    {
209
        return $this->updatedAt;
210
    }
211
212
    /**
213
     * @param \DateTime $updatedAt
214
     *
215
     * @return $this
216
     */
217
    public function setUpdatedAt($updatedAt)
218
    {
219
        $this->updatedAt = $updatedAt;
220
221
        return $this;
222
    }
223
224
     /**
225
     * Set comment
226
     *
227
     * @param string $comment
228
      *
229
     * @return ExtraFieldValues
230
     */
231
    public function setComment($comment)
232
    {
233
        $this->comment = $comment;
234
235
        return $this;
236
    }
237
238
    /**
239
     * Get comment
240
     *
241
     * @return string
242
     */
243
    public function getComment()
244
    {
245
        return $this->comment;
246
    }
247
248
249
    /**
250
     * @return AttributeSubjectInterface
251
     */
252
    public function getSubject()
253
    {
254
        return $this->user;
255
    }
256
257
    /**
258
     * @param AttributeSubjectInterface|null $subject
259
     */
260
    public function setSubject(AttributeSubjectInterface $subject = null)
261
    {
262
        //$this->user = $subject;
263
    }
264
265
266
    /**
267
     * @param AttributeSubjectInterface|null $subject
268
     */
269
    public function setSubjectUser(AttributeSubjectInterface $subject = null)
270
    {
271
        $this->user = $subject;
272
    }
273
274
    /**
275
     * @param AttributeSubjectInterface|null $subject
276
     */
277
    public function setSubjectCourse(AttributeSubjectInterface $subject = null)
278
    {
279
        //$this->cours = $subject;
280
    }
281
282
    /**
283
     * @param AttributeSubjectInterface|null $subject
284
     */
285
    public function setSubjectSession(AttributeSubjectInterface $subject = null)
286
    {
287
        //$this->user = $subject;
288
    }
289
290
    /**
291
     * @return AttributeInterface
292
     */
293
    public function getAttribute()
294
    {
295
        return $this->attribute;
296
    }
297
298
    /**
299
     * @param AttributeInterface $attribute
300
     *
301
     * @return $this
302
     */
303
    public function setAttribute(AttributeInterface $attribute)
304
    {
305
        $this->attribute = $attribute;
0 ignored issues
show
Documentation Bug introduced by
It seems like $attribute of type object<Sylius\Component\...del\AttributeInterface> is incompatible with the declared type object<Chamilo\CoreBundle\Entity\ExtraField> of property $attribute.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
306
307
        return $this;
308
    }
309
310
    /**
311
     * @return mixed
312
     */
313
    public function getValue()
314
    {
315
        return $this->value;
316
    }
317
318
    /**
319
     * @param mixed $value
320
     * @return $this
321
     */
322
    public function setValue($value)
323
    {
324
        $this->value = $value;
325
        return $this;
326
    }
327
328
    /**
329
     * Proxy method to access the code from real attribute.
330
     *
331
     * @return string
332
     */
333
    public function getCode()
334
    {
335
        return $this->attribute->getVariable();
336
    }
337
338
    /**
339
     * @inheritDoc
340
     */
341
    public function getPresentation()
342
    {
343
        // TODO: Implement getPresentation() method.
344
    }
345
346
    /**
347
     * @inheritDoc
348
     */
349
    public function getConfiguration()
350
    {
351
        // TODO: Implement getConfiguration() method.
352
    }
353
354
355
}
356