1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | /* For licensing terms, see /license.txt */ |
||
6 | |||
7 | namespace Chamilo\CourseBundle\Entity; |
||
8 | |||
9 | use Chamilo\CoreBundle\Entity\Course; |
||
10 | use Chamilo\CoreBundle\Entity\Session; |
||
11 | use Chamilo\CoreBundle\Entity\User; |
||
12 | use DateTime; |
||
13 | use Doctrine\ORM\Mapping as ORM; |
||
14 | |||
15 | #[ORM\Table(name: 'c_survey_invitation')] |
||
16 | #[ORM\Index(name: 'course', columns: ['c_id'])] |
||
17 | #[ORM\Entity] |
||
18 | class CSurveyInvitation |
||
19 | { |
||
20 | #[ORM\Column(name: 'iid', type: 'integer')] |
||
21 | #[ORM\Id] |
||
22 | #[ORM\GeneratedValue] |
||
23 | protected ?int $iid = null; |
||
24 | |||
25 | #[ORM\ManyToOne(targetEntity: Course::class)] |
||
26 | #[ORM\JoinColumn(name: 'c_id', referencedColumnName: 'id', nullable: true, onDelete: 'CASCADE')] |
||
27 | protected ?Course $course = null; |
||
28 | |||
29 | #[ORM\ManyToOne(targetEntity: Session::class, inversedBy: 'resourceLinks')] |
||
30 | #[ORM\JoinColumn(name: 'session_id', referencedColumnName: 'id', nullable: true, onDelete: 'CASCADE')] |
||
31 | protected ?Session $session = null; |
||
32 | |||
33 | #[ORM\ManyToOne(targetEntity: CGroup::class)] |
||
34 | #[ORM\JoinColumn(name: 'group_id', referencedColumnName: 'iid', nullable: true, onDelete: 'CASCADE')] |
||
35 | protected ?CGroup $group = null; |
||
36 | |||
37 | #[ORM\ManyToOne(targetEntity: CSurvey::class, inversedBy: 'invitations')] |
||
38 | #[ORM\JoinColumn(name: 'survey_id', referencedColumnName: 'iid', onDelete: 'SET NULL')] |
||
39 | protected CSurvey $survey; |
||
40 | |||
41 | #[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'surveyInvitations')] |
||
42 | #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'SET NULL')] |
||
43 | protected User $user; |
||
44 | |||
45 | protected string $externalEmail; |
||
46 | |||
47 | #[ORM\Column(name: 'invitation_code', type: 'string', length: 250, nullable: false)] |
||
48 | protected string $invitationCode; |
||
49 | |||
50 | #[ORM\Column(name: 'answered', type: 'integer', nullable: false)] |
||
51 | protected int $answered; |
||
52 | |||
53 | #[ORM\Column(name: 'invitation_date', type: 'datetime', nullable: false)] |
||
54 | protected DateTime $invitationDate; |
||
55 | |||
56 | #[ORM\Column(name: 'reminder_date', type: 'datetime', nullable: true)] |
||
57 | protected ?DateTime $reminderDate = null; |
||
58 | |||
59 | #[ORM\Column(name: 'answered_at', type: 'datetime', nullable: true)] |
||
60 | protected ?DateTime $answeredAt = null; |
||
61 | |||
62 | #[ORM\Column(name: 'c_lp_item_id', type: 'integer', nullable: false)] |
||
63 | protected int $lpItemId; |
||
64 | |||
65 | public function __construct() |
||
66 | { |
||
67 | $this->answered = 0; |
||
68 | $this->lpItemId = 0; |
||
69 | $this->invitationDate = new DateTime(); |
||
70 | } |
||
71 | |||
72 | public function getSurvey(): CSurvey |
||
73 | { |
||
74 | return $this->survey; |
||
75 | } |
||
76 | |||
77 | public function setSurvey(CSurvey $survey): self |
||
78 | { |
||
79 | $this->survey = $survey; |
||
80 | |||
81 | return $this; |
||
82 | } |
||
83 | |||
84 | public function getUser(): User |
||
85 | { |
||
86 | return $this->user; |
||
87 | } |
||
88 | |||
89 | public function setUser(User $user): self |
||
90 | { |
||
91 | $this->user = $user; |
||
92 | |||
93 | return $this; |
||
94 | } |
||
95 | |||
96 | /** |
||
97 | * Get invitationCode. |
||
98 | * |
||
99 | * @return string |
||
100 | */ |
||
101 | public function getInvitationCode() |
||
102 | { |
||
103 | return $this->invitationCode; |
||
104 | } |
||
105 | |||
106 | public function setInvitationCode(string $invitationCode): self |
||
107 | { |
||
108 | $this->invitationCode = $invitationCode; |
||
109 | |||
110 | return $this; |
||
111 | } |
||
112 | |||
113 | /** |
||
114 | * Get invitationDate. |
||
115 | * |
||
116 | * @return DateTime |
||
117 | */ |
||
118 | public function getInvitationDate() |
||
119 | { |
||
120 | return $this->invitationDate; |
||
121 | } |
||
122 | |||
123 | public function setInvitationDate(DateTime $invitationDate): self |
||
124 | { |
||
125 | $this->invitationDate = $invitationDate; |
||
126 | |||
127 | return $this; |
||
128 | } |
||
129 | |||
130 | /** |
||
131 | * Get reminderDate. |
||
132 | * |
||
133 | * @return DateTime |
||
134 | */ |
||
135 | public function getReminderDate() |
||
136 | { |
||
137 | return $this->reminderDate; |
||
138 | } |
||
139 | |||
140 | public function setReminderDate(DateTime $reminderDate): self |
||
141 | { |
||
142 | $this->reminderDate = $reminderDate; |
||
143 | |||
144 | return $this; |
||
145 | } |
||
146 | |||
147 | /** |
||
148 | * Get answered. |
||
149 | * |
||
150 | * @return int |
||
151 | */ |
||
152 | public function getAnswered() |
||
153 | { |
||
154 | return $this->answered; |
||
155 | } |
||
156 | |||
157 | public function setAnswered(int $answered): self |
||
158 | { |
||
159 | $this->answered = $answered; |
||
160 | |||
161 | return $this; |
||
162 | } |
||
163 | |||
164 | public function getAnsweredAt(): DateTime |
||
165 | { |
||
166 | return $this->answeredAt; |
||
0 ignored issues
–
show
Bug
Best Practice
introduced
by
![]() |
|||
167 | } |
||
168 | |||
169 | public function setAnsweredAt(DateTime $answeredAt): self |
||
170 | { |
||
171 | $this->answeredAt = $answeredAt; |
||
172 | |||
173 | return $this; |
||
174 | } |
||
175 | |||
176 | public function getCourse(): ?Course |
||
177 | { |
||
178 | return $this->course; |
||
179 | } |
||
180 | |||
181 | public function setCourse(?Course $course): self |
||
182 | { |
||
183 | $this->course = $course; |
||
184 | |||
185 | return $this; |
||
186 | } |
||
187 | |||
188 | public function getSession(): ?Session |
||
189 | { |
||
190 | return $this->session; |
||
191 | } |
||
192 | |||
193 | public function setSession(?Session $session): self |
||
194 | { |
||
195 | $this->session = $session; |
||
196 | |||
197 | return $this; |
||
198 | } |
||
199 | |||
200 | public function getGroup(): ?CGroup |
||
201 | { |
||
202 | return $this->group; |
||
203 | } |
||
204 | |||
205 | public function setGroup(?CGroup $group): self |
||
206 | { |
||
207 | $this->group = $group; |
||
208 | |||
209 | return $this; |
||
210 | } |
||
211 | |||
212 | /** |
||
213 | * Get LpItemId. |
||
214 | * |
||
215 | * @return int |
||
216 | */ |
||
217 | public function getLpItemId() |
||
218 | { |
||
219 | return $this->lpItemId; |
||
220 | } |
||
221 | |||
222 | /** |
||
223 | * Set LpItemId. |
||
224 | * |
||
225 | * @param int $lpItemId |
||
226 | * |
||
227 | * @return CSurveyInvitation |
||
228 | */ |
||
229 | public function setLpItemId($lpItemId) |
||
230 | { |
||
231 | $this->lpItemId = $lpItemId; |
||
232 | |||
233 | return $this; |
||
234 | } |
||
235 | } |
||
236 |