Passed
Push — 1.11.x ( 106594...56cdc0 )
by Angel Fernando Quiroz
08:52
created

src/Chamilo/FaqBundle/Entity/Question.php (1 issue)

1
<?php
2
/* For licensing terms, see /license.txt */
3
4
namespace Chamilo\FaqBundle\Entity;
5
6
use Doctrine\ORM\Mapping as ORM;
7
use Gedmo\Mapping\Annotation as Gedmo;
8
use Knp\DoctrineBehaviors\Model as ORMBehaviors;
9
10
/**
11
 * Class Question.
12
 *
13
 * @ORM\Entity(repositoryClass="Chamilo\FaqBundle\Entity\QuestionRepository")
14
 * @ORM\Table(name="faq_question")
15
 *
16
 * @package Chamilo\FaqBundle\Entity
17
 */
18
class Question
19
{
20
    use ORMBehaviors\Translatable\Translatable;
21
22
    /**
23
     * @ORM\Column(type="integer")
24
     * @ORM\Id
25
     * @ORM\GeneratedValue(strategy="AUTO")
26
     */
27
    protected $id;
28
29
    /**
30
     * @ORM\ManyToOne(targetEntity="Category", inversedBy="questions")
31
     * @ORM\OrderBy({"rank" = "asc"})
32
     */
33
    protected $category;
34
35
    /**
36
     * @Gedmo\SortablePosition
37
     * @ORM\Column(name="rank", type="integer")
38
     */
39
    protected $rank;
40
41
    /**
42
     * @Gedmo\Timestampable(on="create")
43
     * @ORM\Column(name="created_at", type="datetime")
44
     */
45
    protected $createdAt;
46
47
    /**
48
     * @Gedmo\Timestampable(on="update")
49
     * @ORM\Column(name="updated_at", type="datetime")
50
     */
51
    protected $updatedAt;
52
53
    /**
54
     * @var bool
55
     * @ORM\Column(name="only_auth_users", type="boolean", nullable=false)
56
     */
57
    protected $onlyAuthUsers;
58
59
    /**
60
     * @ORM\Column(name="is_active", type="boolean")
61
     */
62
    protected $isActive;
63
64
    /**
65
     * @param $method
66
     * @param $arguments
67
     *
68
     * @return mixed
69
     */
70
    public function __call($method, $arguments)
71
    {
72
        return $this->proxyCurrentLocaleTranslation($method, $arguments);
73
    }
74
75
    /**
76
     * Returns a string representation of this object.
77
     *
78
     * @return string
79
     */
80
    public function __toString()
81
    {
82
        return $this->getHeadline();
83
    }
84
85
    /**
86
     * Get id.
87
     *
88
     * @return int
89
     */
90
    public function getId()
91
    {
92
        return $this->id;
93
    }
94
95
    /**
96
     * Get rank.
97
     *
98
     * @return string
99
     */
100
    public function getRank()
101
    {
102
        return $this->rank;
103
    }
104
105
    /**
106
     * Set rank.
107
     *
108
     * @param string $rank
109
     *
110
     * @return Question
111
     */
112
    public function setRank($rank)
113
    {
114
        $this->rank = $rank;
0 ignored issues
show
Documentation Bug introduced by
The property $rank was declared of type integer, but $rank is of type string. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
115
116
        return $this;
117
    }
118
119
    /**
120
     * Set createdAt.
121
     *
122
     * @param \DateTime $createdAt
123
     *
124
     * @return Question
125
     */
126
    public function setCreatedAt($createdAt)
127
    {
128
        $this->createdAt = $createdAt;
129
130
        return $this;
131
    }
132
133
    /**
134
     * Get createdAt.
135
     *
136
     * @return \DateTime
137
     */
138
    public function getCreatedAt()
139
    {
140
        return $this->createdAt;
141
    }
142
143
    /**
144
     * Set updatedAt.
145
     *
146
     * @param \DateTime $updatedAt
147
     *
148
     * @return Question
149
     */
150
    public function setUpdatedAt($updatedAt)
151
    {
152
        $this->updatedAt = $updatedAt;
153
154
        return $this;
155
    }
156
157
    /**
158
     * Get updatedAt.
159
     *
160
     * @return \DateTime
161
     */
162
    public function getUpdatedAt()
163
    {
164
        return $this->updatedAt;
165
    }
166
167
    /**
168
     * Set category.
169
     *
170
     * @param Category $category
171
     *
172
     * @return Question
173
     */
174
    public function setCategory(Category $category = null)
175
    {
176
        $this->category = $category;
177
178
        return $this;
179
    }
180
181
    /**
182
     * Get category.
183
     *
184
     * @return Category
185
     */
186
    public function getCategory()
187
    {
188
        return $this->category;
189
    }
190
191
    /**
192
     * Returns the route name for url generation.
193
     *
194
     * @return string
195
     */
196
    public function getRouteName()
197
    {
198
        return 'faq';
199
    }
200
201
    /**
202
     * Returns the route parameters for url generation.
203
     *
204
     * @return array
205
     */
206
    public function getRouteParameters()
207
    {
208
        return [
209
            'categorySlug' => $this->getCategory()->getSlug(),
210
            'questionSlug' => $this->getSlug(),
211
        ];
212
    }
213
214
    /**
215
     * Returns a string representation of the entity build out of BundleName + EntityName + EntityId.
216
     *
217
     * @return string
218
     */
219
    public function getEntityIdentifier()
220
    {
221
        return 'GenjFaqBundle:Question:'.$this->getId();
222
    }
223
224
    /**
225
     * @return bool
226
     */
227
    public function isOnlyAuthUsers()
228
    {
229
        return $this->onlyAuthUsers;
230
    }
231
232
    /**
233
     * @param bool $onlyAuthUsers
234
     *
235
     * @return Question
236
     */
237
    public function setOnlyAuthUsers($onlyAuthUsers)
238
    {
239
        $this->onlyAuthUsers = $onlyAuthUsers;
240
241
        return $this;
242
    }
243
244
    /**
245
     * Set is_active.
246
     *
247
     * @param bool $isActive
248
     *
249
     * @return Question
250
     */
251
    public function setIsActive($isActive)
252
    {
253
        $this->isActive = $isActive;
254
255
        return $this;
256
    }
257
258
    /**
259
     * Get isActive.
260
     *
261
     * @return bool
262
     */
263
    public function getIsActive()
264
    {
265
        return $this->isActive;
266
    }
267
}
268