| Total Complexity | 184 |
| Total Lines | 2222 |
| Duplicated Lines | 0 % |
| Changes | 6 | ||
| Bugs | 3 | Features | 0 |
Complex classes like User often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use User, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 55 | { |
||
| 56 | public const ROLE_DEFAULT = 'ROLE_USER'; |
||
| 57 | public const ROLE_SUPER_ADMIN = 'ROLE_SUPER_ADMIN'; |
||
| 58 | |||
| 59 | public const COURSE_MANAGER = 1; |
||
| 60 | public const TEACHER = 1; |
||
| 61 | public const SESSION_ADMIN = 3; |
||
| 62 | public const DRH = 4; |
||
| 63 | public const STUDENT = 5; |
||
| 64 | public const ANONYMOUS = 6; |
||
| 65 | |||
| 66 | /** |
||
| 67 | * @var int |
||
| 68 | * @Groups({"user:read", "resource_node:read"}) |
||
| 69 | * @ORM\Column(name="id", type="integer") |
||
| 70 | * @ORM\Id |
||
| 71 | * @ORM\GeneratedValue(strategy="AUTO") |
||
| 72 | */ |
||
| 73 | protected $id; |
||
| 74 | |||
| 75 | /** |
||
| 76 | * @var UuidInterface|null |
||
| 77 | * |
||
| 78 | * @ORM\Column(type="uuid", unique=true) |
||
| 79 | */ |
||
| 80 | protected $uuid; |
||
| 81 | |||
| 82 | /** |
||
| 83 | * @ORM\Column(type="string", unique=true, nullable=true) |
||
| 84 | */ |
||
| 85 | protected $apiToken; |
||
| 86 | |||
| 87 | /** |
||
| 88 | * @var string |
||
| 89 | * @Assert\NotBlank() |
||
| 90 | * @ApiProperty(iri="http://schema.org/name") |
||
| 91 | * @Groups({"user:read", "user:write", "resource_node:read"}) |
||
| 92 | * @ORM\Column(name="firstname", type="string", length=64, nullable=true, unique=false) |
||
| 93 | */ |
||
| 94 | protected $firstname; |
||
| 95 | |||
| 96 | /** |
||
| 97 | * @var string |
||
| 98 | * @Groups({"user:read", "user:write", "resource_node:read"}) |
||
| 99 | * @ORM\Column(name="lastname", type="string", length=64, nullable=true, unique=false) |
||
| 100 | */ |
||
| 101 | protected $lastnamt |
||
| 102 | |||
| 103 | /** |
||
| 104 | * @var string |
||
| 105 | * @Groups({"user:read", "user:write"}) |
||
| 106 | * @ORM\Column(name="website", type="string", length=64, nullable=true) |
||
| 107 | */ |
||
| 108 | protected $website; |
||
|
|
|||
| 109 | |||
| 110 | /** |
||
| 111 | * @var string |
||
| 112 | * @Groups({"user:read", "user:write"}) |
||
| 113 | * @ORM\Column(name="biography", type="text", nullable=true) |
||
| 114 | */ |
||
| 115 | protected $biography; |
||
| 116 | |||
| 117 | /** |
||
| 118 | * @var string |
||
| 119 | * @Groups({"user:read", "user:write"}) |
||
| 120 | * @ORM\Column(name="locale", type="string", length=8, nullable=true, unique=false) |
||
| 121 | */ |
||
| 122 | protected $locale; |
||
| 123 | |||
| 124 | /** |
||
| 125 | * @var string |
||
| 126 | * @Groups({"user:read", "user:write", "course:read", "resource_node:read"}) |
||
| 127 | * @Assert\NotBlank() |
||
| 128 | * @ORM\Column(name="username", type="string", length=100, nullable=false, unique=true) |
||
| 129 | */ |
||
| 130 | protected $username; |
||
| 131 | |||
| 132 | /** |
||
| 133 | * @var string|null |
||
| 134 | */ |
||
| 135 | protected $plainPassword; |
||
| 136 | |||
| 137 | /** |
||
| 138 | * @var string |
||
| 139 | * @ORM\Column(name="password", type="string", length=255, nullable=false, unique=false) |
||
| 140 | */ |
||
| 141 | protected $password; |
||
| 142 | |||
| 143 | /** |
||
| 144 | * @var string |
||
| 145 | * |
||
| 146 | * @ORM\Column(name="username_canonical", type="string", length=180, nullable=false) |
||
| 147 | */ |
||
| 148 | protected $usernameCanonical; |
||
| 149 | |||
| 150 | /** |
||
| 151 | * @var string |
||
| 152 | * @Groups({"user:read", "user:write"}) |
||
| 153 | * @ORM\Column(name="timezone", type="string", length=64) |
||
| 154 | */ |
||
| 155 | protected $timezone; |
||
| 156 | |||
| 157 | /** |
||
| 158 | * @var string |
||
| 159 | * @ORM\Column(name="email_canonical", type="string", length=100, nullable=false, unique=false) |
||
| 160 | */ |
||
| 161 | protected $emailCanonical; |
||
| 162 | |||
| 163 | /** |
||
| 164 | * @var string |
||
| 165 | * @var string |
||
| 166 | * @Groups({"user:read", "user:write"}) |
||
| 167 | * @Assert\NotBlank() |
||
| 168 | * @Assert\Email() |
||
| 169 | * |
||
| 170 | * @ORM\Column(name="email", type="string", length=100, nullable=false, unique=false) |
||
| 171 | */ |
||
| 172 | protected $email; |
||
| 173 | |||
| 174 | /** |
||
| 175 | * @var bool |
||
| 176 | * |
||
| 177 | * @ORM\Column(name="locked", type="boolean") |
||
| 178 | */ |
||
| 179 | protected $locked; |
||
| 180 | |||
| 181 | /** |
||
| 182 | * @var bool |
||
| 183 | * @Assert\NotBlank() |
||
| 184 | * @Groups({"user:read", "user:write"}) |
||
| 185 | * @ORM\Column(name="enabled", type="boolean") |
||
| 186 | */ |
||
| 187 | protected $enabled; |
||
| 188 | |||
| 189 | /** |
||
| 190 | * @var bool |
||
| 191 | * @Groups({"user:read", "user:write"}) |
||
| 192 | * @ORM\Column(name="expired", type="boolean") |
||
| 193 | */ |
||
| 194 | protected $expired; |
||
| 195 | |||
| 196 | /** |
||
| 197 | * @var bool |
||
| 198 | * |
||
| 199 | * @ORM\Column(name="credentials_expired", type="boolean") |
||
| 200 | */ |
||
| 201 | protected $credentialsExpired; |
||
| 202 | |||
| 203 | /** |
||
| 204 | * @var \DateTime |
||
| 205 | * |
||
| 206 | * @ORM\Column(name="credentials_expire_at", type="datetime", nullable=true, unique=false) |
||
| 207 | */ |
||
| 208 | protected $credentialsExpireAt; |
||
| 209 | |||
| 210 | /** |
||
| 211 | * @var \DateTime |
||
| 212 | * |
||
| 213 | * @ORM\Column(name="date_of_birth", type="datetime", nullable=true) |
||
| 214 | */ |
||
| 215 | protected $dateOfBirth; |
||
| 216 | |||
| 217 | /** |
||
| 218 | * @var \DateTime |
||
| 219 | * @Groups({"user:read", "user:write"}) |
||
| 220 | * @ORM\Column(name="expires_at", type="datetime", nullable=true, unique=false) |
||
| 221 | */ |
||
| 222 | protected $expiresAt; |
||
| 223 | |||
| 224 | /** |
||
| 225 | * @var string |
||
| 226 | * @Groups({"user:read", "user:write"}) |
||
| 227 | * @ORM\Column(name="phone", type="string", length=64, nullable=true, unique=false) |
||
| 228 | */ |
||
| 229 | protected $phone; |
||
| 230 | |||
| 231 | /** |
||
| 232 | * @var string |
||
| 233 | * @Groups({"user:read", "user:write"}) |
||
| 234 | * @ORM\Column(name="address", type="string", length=250, nullable=true, unique=false) |
||
| 235 | */ |
||
| 236 | protected $address; |
||
| 237 | |||
| 238 | /** |
||
| 239 | * @var AccessUrl |
||
| 240 | */ |
||
| 241 | protected $currentUrl; |
||
| 242 | |||
| 243 | /** |
||
| 244 | * @ORM\Column(type="string", length=255) |
||
| 245 | */ |
||
| 246 | protected $salt; |
||
| 247 | |||
| 248 | /** |
||
| 249 | * @var \DateTime |
||
| 250 | * @Groups({"user:read", "user:write"}) |
||
| 251 | * @ORM\Column(name="last_login", type="datetime", nullable=true, unique=false) |
||
| 252 | */ |
||
| 253 | protected $lastLogin; |
||
| 254 | |||
| 255 | /** |
||
| 256 | * Random string sent to the user email address in order to verify it. |
||
| 257 | * |
||
| 258 | * @var string |
||
| 259 | * @ORM\Column(name="confirmation_token", type="string", length=255, nullable=true) |
||
| 260 | */ |
||
| 261 | protected $confirmationToken; |
||
| 262 | |||
| 263 | /** |
||
| 264 | * @var \DateTime |
||
| 265 | * |
||
| 266 | * @ORM\Column(name="password_requested_at", type="datetime", nullable=true, unique=false) |
||
| 267 | */ |
||
| 268 | protected $passwordRequestedAt; |
||
| 269 | |||
| 270 | /** |
||
| 271 | * @ApiSubresource() |
||
| 272 | * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\CourseRelUser", mappedBy="user", orphanRemoval=true) |
||
| 273 | */ |
||
| 274 | protected $courses; |
||
| 275 | |||
| 276 | /** |
||
| 277 | * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\UsergroupRelUser", mappedBy="user") |
||
| 278 | */ |
||
| 279 | protected $classes; |
||
| 280 | |||
| 281 | /** |
||
| 282 | * ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CDropboxPost", mappedBy="user"). |
||
| 283 | */ |
||
| 284 | protected $dropBoxReceivedFiles; |
||
| 285 | |||
| 286 | /** |
||
| 287 | * ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CDropboxFile", mappedBy="userSent"). |
||
| 288 | */ |
||
| 289 | protected $dropBoxSentFiles; |
||
| 290 | |||
| 291 | /** |
||
| 292 | * @Groups({"user:read", "user:write"}) |
||
| 293 | * @ORM\Column(type="array") |
||
| 294 | */ |
||
| 295 | protected $roles; |
||
| 296 | |||
| 297 | /** |
||
| 298 | * @var bool |
||
| 299 | * |
||
| 300 | * @ORM\Column(name="profile_completed", type="boolean", nullable=true) |
||
| 301 | */ |
||
| 302 | protected $profileCompleted; |
||
| 303 | |||
| 304 | /** |
||
| 305 | * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\JuryMembers", mappedBy="user") |
||
| 306 | */ |
||
| 307 | //protected $jurySubscriptions; |
||
| 308 | |||
| 309 | /** |
||
| 310 | * @var Group[] |
||
| 311 | * @ORM\ManyToMany(targetEntity="Chamilo\CoreBundle\Entity\Group", inversedBy="users") |
||
| 312 | * @ORM\JoinTable( |
||
| 313 | * name="fos_user_user_group", |
||
| 314 | * joinColumns={ |
||
| 315 | * @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="cascade") |
||
| 316 | * }, |
||
| 317 | * inverseJoinColumns={ |
||
| 318 | * @ORM\JoinColumn(name="group_id", referencedColumnName="id") |
||
| 319 | * } |
||
| 320 | * ) |
||
| 321 | */ |
||
| 322 | protected $groups; |
||
| 323 | |||
| 324 | /** |
||
| 325 | * ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\CurriculumItemRelUser", mappedBy="user"). |
||
| 326 | */ |
||
| 327 | protected $curriculumItems; |
||
| 328 | |||
| 329 | /** |
||
| 330 | * @ORM\OneToMany( |
||
| 331 | * targetEntity="Chamilo\CoreBundle\Entity\AccessUrlRelUser", |
||
| 332 | * mappedBy="user", |
||
| 333 | * cascade={"persist", "remove"}, |
||
| 334 | * orphanRemoval=true |
||
| 335 | * ) |
||
| 336 | */ |
||
| 337 | protected $portals; |
||
| 338 | |||
| 339 | /** |
||
| 340 | * @var Admin |
||
| 341 | * @ORM\OneToOne( |
||
| 342 | * targetEntity="Chamilo\CoreBundle\Entity\Admin", |
||
| 343 | * mappedBy="user", |
||
| 344 | * cascade={"persist", "remove"}, |
||
| 345 | * orphanRemoval=true |
||
| 346 | * ) |
||
| 347 | */ |
||
| 348 | protected $admin; |
||
| 349 | |||
| 350 | /** |
||
| 351 | * @var ArrayCollection |
||
| 352 | * @ORM\OneToMany( |
||
| 353 | * targetEntity="Chamilo\CoreBundle\Entity\GradebookCertificate", |
||
| 354 | * mappedBy="user", |
||
| 355 | * cascade={"persist", "remove"}, |
||
| 356 | * orphanRemoval=true |
||
| 357 | * ) |
||
| 358 | */ |
||
| 359 | protected $gradebookCertificates; |
||
| 360 | |||
| 361 | /** |
||
| 362 | * @var ArrayCollection |
||
| 363 | * @ORM\OneToMany( |
||
| 364 | * targetEntity="Chamilo\CoreBundle\Entity\GradebookEvaluation", |
||
| 365 | * mappedBy="user", |
||
| 366 | * cascade={"persist", "remove"}, |
||
| 367 | * orphanRemoval=true |
||
| 368 | * ) |
||
| 369 | */ |
||
| 370 | protected $gradebookEvaluations; |
||
| 371 | |||
| 372 | /** |
||
| 373 | * @var ArrayCollection |
||
| 374 | * @ORM\OneToMany( |
||
| 375 | * targetEntity="Chamilo\CoreBundle\Entity\GradebookLink", |
||
| 376 | * mappedBy="user", |
||
| 377 | * cascade={"persist", "remove"}, |
||
| 378 | * orphanRemoval=true |
||
| 379 | * ) |
||
| 380 | */ |
||
| 381 | protected $gradebookLinks; |
||
| 382 | |||
| 383 | /** |
||
| 384 | * @var ArrayCollection |
||
| 385 | * @ORM\OneToMany( |
||
| 386 | * targetEntity="Chamilo\CoreBundle\Entity\GradebookResult", |
||
| 387 | * mappedBy="user", |
||
| 388 | * cascade={"persist", "remove"}, |
||
| 389 | * orphanRemoval=true |
||
| 390 | * ) |
||
| 391 | */ |
||
| 392 | protected $gradebookResults; |
||
| 393 | |||
| 394 | /** |
||
| 395 | * @var ArrayCollection |
||
| 396 | * @ORM\OneToMany( |
||
| 397 | * targetEntity="Chamilo\CoreBundle\Entity\GradebookResultLog", |
||
| 398 | * mappedBy="user", |
||
| 399 | * cascade={"persist", "remove"}, |
||
| 400 | * orphanRemoval=true |
||
| 401 | * ) |
||
| 402 | */ |
||
| 403 | protected $gradebookResultLogs; |
||
| 404 | |||
| 405 | /** |
||
| 406 | * @var ArrayCollection |
||
| 407 | * @ORM\OneToMany( |
||
| 408 | * targetEntity="Chamilo\CoreBundle\Entity\GradebookScoreLog", |
||
| 409 | * mappedBy="user", |
||
| 410 | * cascade={"persist", "remove"}, |
||
| 411 | * orphanRemoval=true |
||
| 412 | * ) |
||
| 413 | */ |
||
| 414 | protected $gradebookScoreLogs; |
||
| 415 | |||
| 416 | /** |
||
| 417 | * @var ArrayCollection |
||
| 418 | * @ORM\OneToMany( |
||
| 419 | * targetEntity="Chamilo\CoreBundle\Entity\SequenceValue", |
||
| 420 | * mappedBy="user", |
||
| 421 | * cascade={"persist", "remove"}, |
||
| 422 | * orphanRemoval=true |
||
| 423 | * ) |
||
| 424 | */ |
||
| 425 | protected $sequenceValues; |
||
| 426 | |||
| 427 | /** |
||
| 428 | * @var ArrayCollection |
||
| 429 | * @ORM\OneToMany( |
||
| 430 | * targetEntity="Chamilo\CoreBundle\Entity\TrackEExerciseConfirmation", |
||
| 431 | * mappedBy="user", |
||
| 432 | * cascade={"persist", "remove"}, |
||
| 433 | * orphanRemoval=true |
||
| 434 | * ) |
||
| 435 | */ |
||
| 436 | protected $trackEExerciseConfirmations; |
||
| 437 | |||
| 438 | /** |
||
| 439 | * @var ArrayCollection |
||
| 440 | * @ORM\OneToMany( |
||
| 441 | * targetEntity="Chamilo\CoreBundle\Entity\Templates", |
||
| 442 | * mappedBy="user", |
||
| 443 | * cascade={"persist", "remove"}, |
||
| 444 | * orphanRemoval=true |
||
| 445 | * ) |
||
| 446 | */ |
||
| 447 | protected $templates; |
||
| 448 | |||
| 449 | /** |
||
| 450 | * @var ArrayCollection |
||
| 451 | * @ORM\OneToMany( |
||
| 452 | * targetEntity="Chamilo\CoreBundle\Entity\TrackEAttempt", |
||
| 453 | * mappedBy="user", |
||
| 454 | * cascade={"persist", "remove"}, |
||
| 455 | * orphanRemoval=true |
||
| 456 | * ) |
||
| 457 | */ |
||
| 458 | protected $trackEAttempts; |
||
| 459 | |||
| 460 | /** |
||
| 461 | * @var ArrayCollection |
||
| 462 | * @ORM\OneToMany( |
||
| 463 | * targetEntity="Chamilo\CoreBundle\Entity\TrackECourseAccess", |
||
| 464 | * mappedBy="user", |
||
| 465 | * cascade={"persist", "remove"}, |
||
| 466 | * orphanRemoval=true |
||
| 467 | * ) |
||
| 468 | */ |
||
| 469 | protected $trackECourseAccess; |
||
| 470 | |||
| 471 | /** |
||
| 472 | * @var ArrayCollection |
||
| 473 | * @ORM\OneToMany( |
||
| 474 | * targetEntity="Chamilo\CoreBundle\Entity\UserCourseCategory", |
||
| 475 | * mappedBy="user", |
||
| 476 | * cascade={"persist", "remove"}, |
||
| 477 | * orphanRemoval=true |
||
| 478 | * ) |
||
| 479 | */ |
||
| 480 | protected $userCourseCategorys; |
||
| 481 | |||
| 482 | /** |
||
| 483 | * @var ArrayCollection |
||
| 484 | * @ORM\OneToMany( |
||
| 485 | * targetEntity="Chamilo\CoreBundle\Entity\UserRelCourseVote", |
||
| 486 | * mappedBy="user", |
||
| 487 | * cascade={"persist", "remove"}, |
||
| 488 | * orphanRemoval=true |
||
| 489 | * ) |
||
| 490 | */ |
||
| 491 | protected $userRelCourseVotes; |
||
| 492 | |||
| 493 | /** |
||
| 494 | * @var ArrayCollection |
||
| 495 | * @ORM\OneToMany( |
||
| 496 | * targetEntity="Chamilo\CoreBundle\Entity\UserRelTag", |
||
| 497 | * mappedBy="user", |
||
| 498 | * cascade={"persist", "remove"}, |
||
| 499 | * orphanRemoval=true |
||
| 500 | * ) |
||
| 501 | */ |
||
| 502 | protected $userRelTags; |
||
| 503 | |||
| 504 | /** |
||
| 505 | * @var ArrayCollection |
||
| 506 | * @ORM\OneToMany( |
||
| 507 | * targetEntity="Chamilo\CoreBundle\Entity\GradebookLinkevalLog", |
||
| 508 | * mappedBy="user", |
||
| 509 | * cascade={"persist", "remove"}, |
||
| 510 | * orphanRemoval=true |
||
| 511 | * ) |
||
| 512 | */ |
||
| 513 | protected $gradebookLinkevalLogs; |
||
| 514 | |||
| 515 | /** |
||
| 516 | * @var ArrayCollection |
||
| 517 | * @ORM\OneToMany( |
||
| 518 | * targetEntity="Chamilo\CoreBundle\Entity\UserRelUser", |
||
| 519 | * mappedBy="user", |
||
| 520 | * cascade={"persist", "remove"}, |
||
| 521 | * orphanRemoval=true |
||
| 522 | * ) |
||
| 523 | */ |
||
| 524 | protected $userRelationships; |
||
| 525 | |||
| 526 | /** |
||
| 527 | * @var ArrayCollection |
||
| 528 | * @ORM\OneToMany( |
||
| 529 | * targetEntity="Chamilo\CourseBundle\Entity\CAttendanceResult", |
||
| 530 | * mappedBy="user", |
||
| 531 | * cascade={"persist", "remove"}, |
||
| 532 | * orphanRemoval=true |
||
| 533 | * ) |
||
| 534 | */ |
||
| 535 | protected $cAttendanceResults; |
||
| 536 | |||
| 537 | /** |
||
| 538 | * @var ArrayCollection |
||
| 539 | * @ORM\OneToMany( |
||
| 540 | * targetEntity="Chamilo\CourseBundle\Entity\CAttendanceSheet", |
||
| 541 | * mappedBy="user", |
||
| 542 | * cascade={"persist", "remove"}, |
||
| 543 | * orphanRemoval=true |
||
| 544 | * ) |
||
| 545 | */ |
||
| 546 | protected $cAttendanceSheets; |
||
| 547 | |||
| 548 | /** |
||
| 549 | * @var ArrayCollection |
||
| 550 | * @ORM\OneToMany( |
||
| 551 | * targetEntity="Chamilo\CourseBundle\Entity\CBlogRating", |
||
| 552 | * mappedBy="user", |
||
| 553 | * cascade={"persist", "remove"}, |
||
| 554 | * orphanRemoval=true |
||
| 555 | * ) |
||
| 556 | */ |
||
| 557 | protected $cBlogRatings; |
||
| 558 | |||
| 559 | /** |
||
| 560 | * @var ArrayCollection |
||
| 561 | * @ORM\OneToMany( |
||
| 562 | * targetEntity="Chamilo\CourseBundle\Entity\CBlogRelUser", |
||
| 563 | * mappedBy="user", |
||
| 564 | * cascade={"persist", "remove"}, |
||
| 565 | * orphanRemoval=true |
||
| 566 | * ) |
||
| 567 | */ |
||
| 568 | protected $cBlogRelUsers; |
||
| 569 | |||
| 570 | /** |
||
| 571 | * @var ArrayCollection |
||
| 572 | * @ORM\OneToMany( |
||
| 573 | * targetEntity="Chamilo\CourseBundle\Entity\CBlogTaskRelUser", |
||
| 574 | * mappedBy="user", |
||
| 575 | * cascade={"persist", "remove"}, |
||
| 576 | * orphanRemoval=true |
||
| 577 | * ) |
||
| 578 | */ |
||
| 579 | protected $cBlogTaskRelUsers; |
||
| 580 | |||
| 581 | /** |
||
| 582 | * @var ArrayCollection |
||
| 583 | * @ORM\OneToMany( |
||
| 584 | * targetEntity="Chamilo\CourseBundle\Entity\CChatConnected", |
||
| 585 | * mappedBy="user", |
||
| 586 | * cascade={"persist", "remove"}, |
||
| 587 | * orphanRemoval=true |
||
| 588 | * ) |
||
| 589 | */ |
||
| 590 | protected $cChatConnected; |
||
| 591 | |||
| 592 | /** |
||
| 593 | * @var ArrayCollection |
||
| 594 | * @ORM\OneToMany( |
||
| 595 | * targetEntity="Chamilo\CourseBundle\Entity\CDropboxCategory", |
||
| 596 | * mappedBy="user", |
||
| 597 | * cascade={"persist", "remove"}, |
||
| 598 | * orphanRemoval=true |
||
| 599 | * ) |
||
| 600 | */ |
||
| 601 | protected $cDropboxCategorys; |
||
| 602 | /** |
||
| 603 | * @var ArrayCollection |
||
| 604 | * @ORM\OneToMany( |
||
| 605 | * targetEntity="Chamilo\CourseBundle\Entity\CDropboxPerson", |
||
| 606 | * mappedBy="user", |
||
| 607 | * cascade={"persist", "remove"}, |
||
| 608 | * orphanRemoval=true |
||
| 609 | * ) |
||
| 610 | */ |
||
| 611 | protected $cDropboxPersons; |
||
| 612 | |||
| 613 | /** |
||
| 614 | * @var ArrayCollection |
||
| 615 | * @ORM\OneToMany( |
||
| 616 | * targetEntity="Chamilo\CourseBundle\Entity\CForumMailcue", |
||
| 617 | * mappedBy="user", |
||
| 618 | * cascade={"persist", "remove"}, |
||
| 619 | * orphanRemoval=true |
||
| 620 | * ) |
||
| 621 | */ |
||
| 622 | protected $cForumMailcues; |
||
| 623 | /** |
||
| 624 | * @var ArrayCollection |
||
| 625 | * @ORM\OneToMany( |
||
| 626 | * targetEntity="Chamilo\CourseBundle\Entity\CForumNotification", |
||
| 627 | * mappedBy="user", |
||
| 628 | * cascade={"persist", "remove"}, |
||
| 629 | * orphanRemoval=true |
||
| 630 | * ) |
||
| 631 | */ |
||
| 632 | protected $cForumNotifications; |
||
| 633 | /** |
||
| 634 | * @var ArrayCollection |
||
| 635 | * @ORM\OneToMany( |
||
| 636 | * targetEntity="Chamilo\CourseBundle\Entity\CForumThreadQualify", |
||
| 637 | * mappedBy="user", |
||
| 638 | * cascade={"persist", "remove"}, |
||
| 639 | * orphanRemoval=true |
||
| 640 | * ) |
||
| 641 | */ |
||
| 642 | protected $cForumThreadQualifys; |
||
| 643 | /** |
||
| 644 | * @var ArrayCollection |
||
| 645 | * @ORM\OneToMany( |
||
| 646 | * targetEntity="Chamilo\CourseBundle\Entity\CForumThreadQualifyLog", |
||
| 647 | * mappedBy="user", |
||
| 648 | * cascade={"persist", "remove"}, |
||
| 649 | * orphanRemoval=true |
||
| 650 | * ) |
||
| 651 | */ |
||
| 652 | protected $cForumThreadQualifyLogs; |
||
| 653 | /** |
||
| 654 | * @var ArrayCollection |
||
| 655 | * @ORM\OneToMany( |
||
| 656 | * targetEntity="Chamilo\CourseBundle\Entity\CLpView", |
||
| 657 | * mappedBy="user", |
||
| 658 | * cascade={"persist", "remove"}, |
||
| 659 | * orphanRemoval=true |
||
| 660 | * ) |
||
| 661 | */ |
||
| 662 | protected $cLpViews; |
||
| 663 | /** |
||
| 664 | * @var ArrayCollection |
||
| 665 | * @ORM\OneToMany( |
||
| 666 | * targetEntity="Chamilo\CourseBundle\Entity\CNotebook", |
||
| 667 | * mappedBy="user", |
||
| 668 | * cascade={"persist", "remove"}, |
||
| 669 | * orphanRemoval=true |
||
| 670 | * ) |
||
| 671 | */ |
||
| 672 | protected $cNotebooks; |
||
| 673 | /** |
||
| 674 | * @var ArrayCollection |
||
| 675 | * @ORM\OneToMany( |
||
| 676 | * targetEntity="Chamilo\CourseBundle\Entity\COnlineConnected", |
||
| 677 | * mappedBy="user", |
||
| 678 | * cascade={"persist", "remove"}, |
||
| 679 | * orphanRemoval=true |
||
| 680 | * ) |
||
| 681 | */ |
||
| 682 | protected $cOnlineConnected; |
||
| 683 | /** |
||
| 684 | * @var ArrayCollection |
||
| 685 | * @ORM\OneToMany( |
||
| 686 | * targetEntity="Chamilo\CourseBundle\Entity\CRoleUser", |
||
| 687 | * mappedBy="user", |
||
| 688 | * cascade={"persist", "remove"}, |
||
| 689 | * orphanRemoval=true |
||
| 690 | * ) |
||
| 691 | */ |
||
| 692 | protected $cRoleUsers; |
||
| 693 | /** |
||
| 694 | * @var ArrayCollection |
||
| 695 | * @ORM\OneToMany( |
||
| 696 | * targetEntity="Chamilo\CourseBundle\Entity\CStudentPublication", |
||
| 697 | * mappedBy="user", |
||
| 698 | * cascade={"persist", "remove"}, |
||
| 699 | * orphanRemoval=true |
||
| 700 | * ) |
||
| 701 | */ |
||
| 702 | protected $cStudentPublications; |
||
| 703 | /** |
||
| 704 | * @var ArrayCollection |
||
| 705 | * @ORM\OneToMany( |
||
| 706 | * targetEntity="Chamilo\CourseBundle\Entity\CStudentPublicationComment", |
||
| 707 | * mappedBy="user", |
||
| 708 | * cascade={"persist", "remove"}, |
||
| 709 | * orphanRemoval=true |
||
| 710 | * ) |
||
| 711 | */ |
||
| 712 | protected $cStudentPublicationComments; |
||
| 713 | /** |
||
| 714 | * @var ArrayCollection |
||
| 715 | * @ORM\OneToMany( |
||
| 716 | * targetEntity="Chamilo\CourseBundle\Entity\CStudentPublicationRelUser", |
||
| 717 | * mappedBy="user", |
||
| 718 | * cascade={"persist", "remove"}, |
||
| 719 | * orphanRemoval=true |
||
| 720 | * ) |
||
| 721 | */ |
||
| 722 | protected $CStudentPublicationRelUser; |
||
| 723 | /** |
||
| 724 | * @var ArrayCollection |
||
| 725 | * @ORM\OneToMany( |
||
| 726 | * targetEntity="Chamilo\CourseBundle\Entity\CWiki", |
||
| 727 | * mappedBy="user", |
||
| 728 | * cascade={"persist", "remove"}, |
||
| 729 | * orphanRemoval=true |
||
| 730 | * ) |
||
| 731 | */ |
||
| 732 | protected $cWiki; |
||
| 733 | /** |
||
| 734 | * @var ArrayCollection |
||
| 735 | * @ORM\OneToMany( |
||
| 736 | * targetEntity="Chamilo\CourseBundle\Entity\CWikiMailcue", |
||
| 737 | * mappedBy="user", |
||
| 738 | * cascade={"persist", "remove"}, |
||
| 739 | * orphanRemoval=true |
||
| 740 | * ) |
||
| 741 | */ |
||
| 742 | protected $cWikiMailcues; |
||
| 743 | |||
| 744 | /** |
||
| 745 | * @var TrackEAccessComplete |
||
| 746 | * @ORM\OneToOne ( |
||
| 747 | * targetEntity="Chamilo\CoreBundle\Entity\TrackEAccessComplete", |
||
| 748 | * mappedBy="user", |
||
| 749 | * cascade={"persist", "remove"}, |
||
| 750 | * orphanRemoval=true |
||
| 751 | * ) |
||
| 752 | */ |
||
| 753 | protected $trackEAccessComplete; |
||
| 754 | |||
| 755 | /** |
||
| 756 | * @var ArrayCollection |
||
| 757 | * |
||
| 758 | * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\Session", mappedBy="generalCoach") |
||
| 759 | */ |
||
| 760 | protected $sessionAsGeneralCoach; |
||
| 761 | |||
| 762 | /** |
||
| 763 | * @ORM\OneToOne( |
||
| 764 | * targetEntity="Chamilo\CoreBundle\Entity\ResourceNode", cascade={"remove"}, orphanRemoval=true |
||
| 765 | * ) |
||
| 766 | * @ORM\JoinColumn(name="resource_node_id", referencedColumnName="id", onDelete="CASCADE") |
||
| 767 | */ |
||
| 768 | protected $resourceNode; |
||
| 769 | |||
| 770 | /** |
||
| 771 | * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\ResourceNode", mappedBy="creator") |
||
| 772 | */ |
||
| 773 | protected $resourceNodes; |
||
| 774 | |||
| 775 | /** |
||
| 776 | * @ApiSubresource() |
||
| 777 | * @ORM\OneToMany( |
||
| 778 | * targetEntity="Chamilo\CoreBundle\Entity\SessionRelCourseRelUser", |
||
| 779 | * mappedBy="user", |
||
| 780 | * cascade={"persist"}, |
||
| 781 | * orphanRemoval=true |
||
| 782 | * ) |
||
| 783 | */ |
||
| 784 | protected $sessionCourseSubscriptions; |
||
| 785 | |||
| 786 | /** |
||
| 787 | * @ORM\OneToMany( |
||
| 788 | * targetEntity="Chamilo\CoreBundle\Entity\SkillRelUser", |
||
| 789 | * mappedBy="user", |
||
| 790 | * cascade={"persist", "remove"}, |
||
| 791 | * orphanRemoval=true |
||
| 792 | * ) |
||
| 793 | */ |
||
| 794 | protected $achievedSkills; |
||
| 795 | |||
| 796 | /** |
||
| 797 | * @ORM\OneToMany( |
||
| 798 | * targetEntity="Chamilo\CoreBundle\Entity\SkillRelUserComment", |
||
| 799 | * mappedBy="feedbackGiver", |
||
| 800 | * cascade={"persist", "remove"}, |
||
| 801 | * orphanRemoval=true |
||
| 802 | * ) |
||
| 803 | */ |
||
| 804 | protected $commentedUserSkills; |
||
| 805 | |||
| 806 | /** |
||
| 807 | * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\GradebookCategory", mappedBy="user") |
||
| 808 | */ |
||
| 809 | protected $gradeBookCategories; |
||
| 810 | |||
| 811 | /** |
||
| 812 | * @ORM\OneToMany( |
||
| 813 | * targetEntity="Chamilo\CoreBundle\Entity\SessionRelUser", |
||
| 814 | * mappedBy="user", |
||
| 815 | * cascade={"persist", "remove"}, |
||
| 816 | * orphanRemoval=true |
||
| 817 | * ) |
||
| 818 | */ |
||
| 819 | protected $sessions; |
||
| 820 | |||
| 821 | /** |
||
| 822 | * @var Collection |
||
| 823 | * |
||
| 824 | * @ORM\OneToMany( |
||
| 825 | * targetEntity="Chamilo\CourseBundle\Entity\CGroupRelUser", |
||
| 826 | * mappedBy="user", |
||
| 827 | * cascade={"persist", "remove"}, |
||
| 828 | * orphanRemoval=true |
||
| 829 | * ) |
||
| 830 | */ |
||
| 831 | protected $courseGroupsAsMember; |
||
| 832 | |||
| 833 | /** |
||
| 834 | * @var Collection |
||
| 835 | * |
||
| 836 | * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CGroupRelTutor", mappedBy="user", orphanRemoval=true) |
||
| 837 | */ |
||
| 838 | protected $courseGroupsAsTutor; |
||
| 839 | |||
| 840 | /** |
||
| 841 | * @var string |
||
| 842 | * |
||
| 843 | * @ORM\Column(name="auth_source", type="string", length=50, nullable=true, unique=false) |
||
| 844 | */ |
||
| 845 | protected $authSource; |
||
| 846 | |||
| 847 | /** |
||
| 848 | * @var int |
||
| 849 | * |
||
| 850 | * @ORM\Column(name="status", type="integer", nullable=false) |
||
| 851 | */ |
||
| 852 | protected $status; |
||
| 853 | |||
| 854 | /** |
||
| 855 | * @var string |
||
| 856 | * |
||
| 857 | * @ORM\Column(name="official_code", type="string", length=40, nullable=true, unique=false) |
||
| 858 | */ |
||
| 859 | protected $officialCode; |
||
| 860 | |||
| 861 | /** |
||
| 862 | * @var string |
||
| 863 | * |
||
| 864 | * @ORM\Column(name="picture_uri", type="string", length=250, nullable=true, unique=false) |
||
| 865 | */ |
||
| 866 | protected $pictureUri; |
||
| 867 | |||
| 868 | /** |
||
| 869 | * @var int |
||
| 870 | * |
||
| 871 | * @ORM\Column(name="creator_id", type="integer", nullable=true, unique=false) |
||
| 872 | */ |
||
| 873 | protected $creatorId; |
||
| 874 | |||
| 875 | /** |
||
| 876 | * @var string |
||
| 877 | * |
||
| 878 | * @ORM\Column(name="competences", type="text", nullable=true, unique=false) |
||
| 879 | */ |
||
| 880 | protected $competences; |
||
| 881 | |||
| 882 | /** |
||
| 883 | * @var string |
||
| 884 | * |
||
| 885 | * @ORM\Column(name="diplomas", type="text", nullable=true, unique=false) |
||
| 886 | */ |
||
| 887 | protected $diplomas; |
||
| 888 | |||
| 889 | /** |
||
| 890 | * @var string |
||
| 891 | * |
||
| 892 | * @ORM\Column(name="openarea", type="text", nullable=true, unique=false) |
||
| 893 | */ |
||
| 894 | protected $openarea; |
||
| 895 | |||
| 896 | /** |
||
| 897 | * @var string |
||
| 898 | * |
||
| 899 | * @ORM\Column(name="teach", type="text", nullable=true, unique=false) |
||
| 900 | */ |
||
| 901 | protected $teach; |
||
| 902 | |||
| 903 | /** |
||
| 904 | * @var string |
||
| 905 | * |
||
| 906 | * @ORM\Column(name="productions", type="string", length=250, nullable=true, unique=false) |
||
| 907 | */ |
||
| 908 | protected $productions; |
||
| 909 | |||
| 910 | /** |
||
| 911 | * @var string |
||
| 912 | * |
||
| 913 | * @ORM\Column(name="language", type="string", length=40, nullable=true, unique=false) |
||
| 914 | */ |
||
| 915 | protected $language; |
||
| 916 | |||
| 917 | /** |
||
| 918 | * @var \DateTime |
||
| 919 | * |
||
| 920 | * @ORM\Column(name="registration_date", type="datetime", nullable=false, unique=false) |
||
| 921 | */ |
||
| 922 | protected $registrationDate; |
||
| 923 | |||
| 924 | /** |
||
| 925 | * @var \DateTime |
||
| 926 | * |
||
| 927 | * @ORM\Column(name="expiration_date", type="datetime", nullable=true, unique=false) |
||
| 928 | */ |
||
| 929 | protected $expirationDate; |
||
| 930 | |||
| 931 | /** |
||
| 932 | * @var bool |
||
| 933 | * |
||
| 934 | * @ORM\Column(name="active", type="boolean", nullable=false, unique=false) |
||
| 935 | */ |
||
| 936 | protected $active; |
||
| 937 | |||
| 938 | /** |
||
| 939 | * @var string |
||
| 940 | * |
||
| 941 | * @ORM\Column(name="openid", type="string", length=255, nullable=true, unique=false) |
||
| 942 | */ |
||
| 943 | protected $openid; |
||
| 944 | |||
| 945 | /** |
||
| 946 | * @var string |
||
| 947 | * |
||
| 948 | * @ORM\Column(name="theme", type="string", length=255, nullable=true, unique=false) |
||
| 949 | */ |
||
| 950 | protected $theme; |
||
| 951 | |||
| 952 | /** |
||
| 953 | * @var int |
||
| 954 | * |
||
| 955 | * @ORM\Column(name="hr_dept_id", type="smallint", nullable=true, unique=false) |
||
| 956 | */ |
||
| 957 | protected $hrDeptId; |
||
| 958 | |||
| 959 | /** |
||
| 960 | * @var ArrayCollection |
||
| 961 | * |
||
| 962 | * @ORM\OneToMany( |
||
| 963 | * targetEntity="Chamilo\CoreBundle\Entity\Message", |
||
| 964 | * mappedBy="userSender", |
||
| 965 | * cascade={"persist", "remove"}, |
||
| 966 | * orphanRemoval=true |
||
| 967 | * ) |
||
| 968 | */ |
||
| 969 | protected $sentMessages; |
||
| 970 | |||
| 971 | /** |
||
| 972 | * @var ArrayCollection |
||
| 973 | * |
||
| 974 | * @ORM\OneToMany( |
||
| 975 | * targetEntity="Chamilo\CoreBundle\Entity\Message", |
||
| 976 | * mappedBy="userReceiver", |
||
| 977 | * cascade={"persist", "remove"}, |
||
| 978 | * orphanRemoval=true |
||
| 979 | * ) |
||
| 980 | */ |
||
| 981 | protected $receivedMessages; |
||
| 982 | |||
| 983 | /** |
||
| 984 | * @var \DateTime |
||
| 985 | * @ORM\Column(name="created_at", type="datetime", nullable=true, unique=false) |
||
| 986 | */ |
||
| 987 | protected $createdAt; |
||
| 988 | |||
| 989 | /** |
||
| 990 | * @var \DateTime |
||
| 991 | * @ORM\Column(name="updated_at", type="datetime", nullable=true, unique=false) |
||
| 992 | */ |
||
| 993 | protected $updatedAt; |
||
| 994 | |||
| 995 | /** |
||
| 996 | * Constructor. |
||
| 997 | */ |
||
| 998 | public function __construct() |
||
| 999 | { |
||
| 1000 | $this->uuid = Uuid::uuid4()->toString(); |
||
| 1001 | $this->status = self::STUDENT; |
||
| 1002 | $this->salt = sha1(uniqid(null, true)); |
||
| 1003 | $this->active = true; |
||
| 1004 | $this->registrationDate = new \DateTime(); |
||
| 1005 | $this->authSource = 'platform'; |
||
| 1006 | $this->courses = new ArrayCollection(); |
||
| 1007 | //$this->items = new ArrayCollection(); |
||
| 1008 | $this->classes = new ArrayCollection(); |
||
| 1009 | $this->curriculumItems = new ArrayCollection(); |
||
| 1010 | $this->portals = new ArrayCollection(); |
||
| 1011 | $this->dropBoxSentFiles = new ArrayCollection(); |
||
| 1012 | $this->dropBoxReceivedFiles = new ArrayCollection(); |
||
| 1013 | $this->groups = new ArrayCollection(); |
||
| 1014 | //$this->extraFields = new ArrayCollection(); |
||
| 1015 | $this->createdAt = new \DateTime(); |
||
| 1016 | $this->updatedAt = new \DateTime(); |
||
| 1017 | |||
| 1018 | $this->enabled = false; |
||
| 1019 | $this->locked = false; |
||
| 1020 | $this->expired = false; |
||
| 1021 | $this->roles = []; |
||
| 1022 | $this->credentialsExpired = false; |
||
| 1023 | |||
| 1024 | $this->courseGroupsAsMember = new ArrayCollection(); |
||
| 1025 | $this->courseGroupsAsTutor = new ArrayCollection(); |
||
| 1026 | } |
||
| 1027 | |||
| 1028 | public function __toString() |
||
| 1029 | { |
||
| 1030 | return $this->username; |
||
| 1031 | } |
||
| 1032 | |||
| 1033 | /** |
||
| 1034 | * @return int |
||
| 1035 | */ |
||
| 1036 | public function getId() |
||
| 1037 | { |
||
| 1038 | return $this->id; |
||
| 1039 | } |
||
| 1040 | |||
| 1041 | /** |
||
| 1042 | * @param int $userId |
||
| 1043 | */ |
||
| 1044 | public function setId($userId) |
||
| 1045 | { |
||
| 1046 | $this->id = $userId; |
||
| 1047 | } |
||
| 1048 | |||
| 1049 | public function getUuid(): UuidInterface |
||
| 1050 | { |
||
| 1051 | return $this->uuid; |
||
| 1052 | } |
||
| 1053 | |||
| 1054 | /** |
||
| 1055 | * @return string |
||
| 1056 | */ |
||
| 1057 | public function __toString() |
||
| 1058 | { |
||
| 1059 | return $this->username; |
||
| 1060 | } |
||
| 1061 | |||
| 1062 | public function setResourceNode(ResourceNode $resourceNode): self |
||
| 1063 | { |
||
| 1064 | $this->resourceNode = $resourceNode; |
||
| 1065 | |||
| 1066 | return $this; |
||
| 1067 | } |
||
| 1068 | |||
| 1069 | public function getResourceNode(): ResourceNode |
||
| 1070 | { |
||
| 1071 | return $this->resourceNode; |
||
| 1072 | } |
||
| 1073 | |||
| 1074 | /** |
||
| 1075 | * @return ArrayCollection|ResourceNode[] |
||
| 1076 | */ |
||
| 1077 | public function getResourceNodes() |
||
| 1078 | { |
||
| 1079 | return $this->resourceNodes; |
||
| 1080 | } |
||
| 1081 | |||
| 1082 | /** |
||
| 1083 | * @return User |
||
| 1084 | */ |
||
| 1085 | public function setResourceNodes($resourceNodes) |
||
| 1086 | { |
||
| 1087 | $this->resourceNodes = $resourceNodes; |
||
| 1088 | |||
| 1089 | return $this; |
||
| 1090 | } |
||
| 1091 | |||
| 1092 | /** |
||
| 1093 | * @ORM\PostPersist() |
||
| 1094 | */ |
||
| 1095 | public function postPersist(LifecycleEventArgs $args) |
||
| 1096 | { |
||
| 1097 | /*$user = $args->getEntity(); |
||
| 1098 | */ |
||
| 1099 | } |
||
| 1100 | |||
| 1101 | /** |
||
| 1102 | * @return ArrayCollection |
||
| 1103 | */ |
||
| 1104 | public function getDropBoxSentFiles() |
||
| 1105 | { |
||
| 1106 | return $this->dropBoxSentFiles; |
||
| 1107 | } |
||
| 1108 | |||
| 1109 | /** |
||
| 1110 | * @return ArrayCollection |
||
| 1111 | */ |
||
| 1112 | public function getDropBoxReceivedFiles() |
||
| 1113 | { |
||
| 1114 | return $this->dropBoxReceivedFiles; |
||
| 1115 | } |
||
| 1116 | |||
| 1117 | /** |
||
| 1118 | * @param ArrayCollection $value |
||
| 1119 | */ |
||
| 1120 | public function setDropBoxSentFiles($value) |
||
| 1121 | { |
||
| 1122 | $this->dropBoxSentFiles = $value; |
||
| 1123 | } |
||
| 1124 | |||
| 1125 | /** |
||
| 1126 | * @param ArrayCollection $value |
||
| 1127 | */ |
||
| 1128 | public function setDropBoxReceivedFiles($value) |
||
| 1129 | { |
||
| 1130 | $this->dropBoxReceivedFiles = $value; |
||
| 1131 | } |
||
| 1132 | |||
| 1133 | /** |
||
| 1134 | * @param ArrayCollection $courses |
||
| 1135 | */ |
||
| 1136 | public function setCourses($courses) |
||
| 1137 | { |
||
| 1138 | $this->courses = $courses; |
||
| 1139 | } |
||
| 1140 | |||
| 1141 | public function getCourses(): Collection |
||
| 1142 | { |
||
| 1143 | return $this->courses; |
||
| 1144 | } |
||
| 1145 | |||
| 1146 | /** |
||
| 1147 | * @return array |
||
| 1148 | */ |
||
| 1149 | public static function getPasswordConstraints() |
||
| 1150 | { |
||
| 1151 | return |
||
| 1152 | [ |
||
| 1153 | new Assert\Length(['min' => 5]), |
||
| 1154 | // Alpha numeric + "_" or "-" |
||
| 1155 | new Assert\Regex( |
||
| 1156 | [ |
||
| 1157 | 'pattern' => '/^[a-z\-_0-9]+$/i', |
||
| 1158 | 'htmlPattern' => '/^[a-z\-_0-9]+$/i', ] |
||
| 1159 | ), |
||
| 1160 | // Min 3 letters - not needed |
||
| 1161 | /*new Assert\Regex(array( |
||
| 1162 | 'pattern' => '/[a-z]{3}/i', |
||
| 1163 | 'htmlPattern' => '/[a-z]{3}/i') |
||
| 1164 | ),*/ |
||
| 1165 | // Min 2 numbers |
||
| 1166 | new Assert\Regex( |
||
| 1167 | [ |
||
| 1168 | 'pattern' => '/[0-9]{2}/', |
||
| 1169 | 'htmlPattern' => '/[0-9]{2}/', ] |
||
| 1170 | ), |
||
| 1171 | ] |
||
| 1172 | ; |
||
| 1173 | } |
||
| 1174 | |||
| 1175 | public static function loadValidatorMetadata(ClassMetadata $metadata) |
||
| 1176 | { |
||
| 1177 | //$metadata->addPropertyConstraint('firstname', new Assert\NotBlank()); |
||
| 1178 | //$metadata->addPropertyConstraint('lastname', new Assert\NotBlank()); |
||
| 1179 | //$metadata->addPropertyConstraint('email', new Assert\Email()); |
||
| 1180 | /* |
||
| 1181 | $metadata->addPropertyConstraint('password', |
||
| 1182 | new Assert\Collection(self::getPasswordConstraints()) |
||
| 1183 | );*/ |
||
| 1184 | |||
| 1185 | /*$metadata->addConstraint(new UniqueEntity(array( |
||
| 1186 | 'fields' => 'username', |
||
| 1187 | 'message' => 'This value is already used.', |
||
| 1188 | )));*/ |
||
| 1189 | |||
| 1190 | /*$metadata->addPropertyConstraint( |
||
| 1191 | 'username', |
||
| 1192 | new Assert\Length(array( |
||
| 1193 | 'min' => 2, |
||
| 1194 | 'max' => 50, |
||
| 1195 | 'minMessage' => 'This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more.', |
||
| 1196 | 'maxMessage' => 'This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less.', |
||
| 1197 | )) |
||
| 1198 | );*/ |
||
| 1199 | } |
||
| 1200 | |||
| 1201 | /** |
||
| 1202 | * @return ArrayCollection |
||
| 1203 | */ |
||
| 1204 | public function getPortals() |
||
| 1205 | { |
||
| 1206 | return $this->portals; |
||
| 1207 | } |
||
| 1208 | |||
| 1209 | /** |
||
| 1210 | * @param $portal |
||
| 1211 | */ |
||
| 1212 | public function setPortal($portal) |
||
| 1213 | { |
||
| 1214 | $this->portals->add($portal); |
||
| 1215 | } |
||
| 1216 | |||
| 1217 | /** |
||
| 1218 | * @param $value |
||
| 1219 | * @param (mixed|string|string[])[] $value |
||
| 1220 | */ |
||
| 1221 | public function setPortals(array $value) |
||
| 1222 | { |
||
| 1223 | $this->portals = $value; |
||
| 1224 | } |
||
| 1225 | |||
| 1226 | /** |
||
| 1227 | * @return ArrayCollection |
||
| 1228 | */ |
||
| 1229 | public function getCurriculumItems() |
||
| 1230 | { |
||
| 1231 | return $this->curriculumItems; |
||
| 1232 | } |
||
| 1233 | |||
| 1234 | /** |
||
| 1235 | * @param $items |
||
| 1236 | * |
||
| 1237 | * @return $this |
||
| 1238 | */ |
||
| 1239 | public function setCurriculumItems(array $items) |
||
| 1240 | { |
||
| 1241 | $this->curriculumItems = $items; |
||
| 1242 | |||
| 1243 | return $this; |
||
| 1244 | } |
||
| 1245 | |||
| 1246 | /** |
||
| 1247 | * @return bool |
||
| 1248 | */ |
||
| 1249 | public function getIsActive() |
||
| 1250 | { |
||
| 1251 | return 1 == $this->active; |
||
| 1252 | } |
||
| 1253 | |||
| 1254 | /** |
||
| 1255 | * @return bool |
||
| 1256 | */ |
||
| 1257 | public function isActive() |
||
| 1258 | { |
||
| 1259 | return $this->getIsActive(); |
||
| 1260 | } |
||
| 1261 | |||
| 1262 | public function isEnabled() |
||
| 1263 | { |
||
| 1264 | return 1 == $this->getActive(); |
||
| 1265 | } |
||
| 1266 | |||
| 1267 | /** |
||
| 1268 | * Set salt. |
||
| 1269 | * |
||
| 1270 | * @param string $salt |
||
| 1271 | * |
||
| 1272 | * @return User |
||
| 1273 | */ |
||
| 1274 | public function setSalt($salt) |
||
| 1275 | { |
||
| 1276 | $this->salt = $salt; |
||
| 1277 | |||
| 1278 | return $this; |
||
| 1279 | } |
||
| 1280 | |||
| 1281 | /** |
||
| 1282 | * Get salt. |
||
| 1283 | * |
||
| 1284 | * @return string |
||
| 1285 | */ |
||
| 1286 | public function getSalt() |
||
| 1287 | { |
||
| 1288 | return $this->salt; |
||
| 1289 | } |
||
| 1290 | |||
| 1291 | /** |
||
| 1292 | * @param ArrayCollection $classes |
||
| 1293 | * |
||
| 1294 | * @return $this |
||
| 1295 | */ |
||
| 1296 | public function setClasses($classes) |
||
| 1297 | { |
||
| 1298 | $this->classes = $classes; |
||
| 1299 | |||
| 1300 | return $this; |
||
| 1301 | } |
||
| 1302 | |||
| 1303 | /** |
||
| 1304 | * @return ArrayCollection |
||
| 1305 | */ |
||
| 1306 | public function getClasses() |
||
| 1307 | { |
||
| 1308 | return $this->classes; |
||
| 1309 | } |
||
| 1310 | |||
| 1311 | public function getLps() |
||
| 1312 | { |
||
| 1313 | //return $this->lps; |
||
| 1314 | /*$criteria = Criteria::create() |
||
| 1315 | ->where(Criteria::expr()->eq("id", "666")) |
||
| 1316 | //->orderBy(array("username" => "ASC")) |
||
| 1317 | //->setFirstResult(0) |
||
| 1318 | //->setMaxResults(20) |
||
| 1319 | ; |
||
| 1320 | $lps = $this->lps->matching($criteria);*/ |
||
| 1321 | /*return $this->lps->filter( |
||
| 1322 | function($entry) use ($idsToFilter) { |
||
| 1323 | return $entry->getId() == 1; |
||
| 1324 | });*/ |
||
| 1325 | } |
||
| 1326 | |||
| 1327 | /** |
||
| 1328 | * Returns the list of classes for the user. |
||
| 1329 | * |
||
| 1330 | * @return string |
||
| 1331 | */ |
||
| 1332 | public function getCompleteNameWithClasses() |
||
| 1333 | { |
||
| 1334 | $classSubscription = $this->getClasses(); |
||
| 1335 | $classList = []; |
||
| 1336 | /** @var UsergroupRelUser $subscription */ |
||
| 1337 | foreach ($classSubscription as $subscription) { |
||
| 1338 | $class = $subscription->getUsergroup(); |
||
| 1339 | $classList[] = $class->getName(); |
||
| 1340 | } |
||
| 1341 | $classString = !empty($classList) ? ' ['.implode(', ', $classList).']' : null; |
||
| 1342 | |||
| 1343 | return \UserManager::formatUserFullName($this).$classString; |
||
| 1344 | } |
||
| 1345 | |||
| 1346 | /** |
||
| 1347 | * Set lastname. |
||
| 1348 | * |
||
| 1349 | * @return User |
||
| 1350 | */ |
||
| 1351 | public function setLastname(string $lastname): self |
||
| 1352 | { |
||
| 1353 | $this->lastname = $lastname; |
||
| 1354 | |||
| 1355 | return $this; |
||
| 1356 | } |
||
| 1357 | |||
| 1358 | /** |
||
| 1359 | * Set firstname. |
||
| 1360 | * |
||
| 1361 | * @return User |
||
| 1362 | */ |
||
| 1363 | public function setFirstname(string $firstname): self |
||
| 1364 | { |
||
| 1365 | $this->firstname = $firstname; |
||
| 1366 | |||
| 1367 | return $this; |
||
| 1368 | } |
||
| 1369 | |||
| 1370 | public function getPassword() |
||
| 1371 | { |
||
| 1372 | return $this->password; |
||
| 1373 | } |
||
| 1374 | |||
| 1375 | public function setPassword(string $password): self |
||
| 1376 | { |
||
| 1377 | $this->password = $password; |
||
| 1378 | |||
| 1379 | return $this; |
||
| 1380 | } |
||
| 1381 | |||
| 1382 | /** |
||
| 1383 | * Set authSource. |
||
| 1384 | * |
||
| 1385 | * @param string $authSource |
||
| 1386 | * |
||
| 1387 | * @return User |
||
| 1388 | */ |
||
| 1389 | public function setAuthSource($authSource) |
||
| 1390 | { |
||
| 1391 | $this->authSource = $authSource; |
||
| 1392 | |||
| 1393 | return $this; |
||
| 1394 | } |
||
| 1395 | |||
| 1396 | /** |
||
| 1397 | * Get authSource. |
||
| 1398 | * |
||
| 1399 | * @return string |
||
| 1400 | */ |
||
| 1401 | public function getAuthSource() |
||
| 1402 | { |
||
| 1403 | return $this->authSource; |
||
| 1404 | } |
||
| 1405 | |||
| 1406 | /** |
||
| 1407 | * Set email. |
||
| 1408 | * |
||
| 1409 | * @param string $email |
||
| 1410 | * |
||
| 1411 | * @return User |
||
| 1412 | */ |
||
| 1413 | public function setEmail($email) |
||
| 1414 | { |
||
| 1415 | $this->email = $email; |
||
| 1416 | |||
| 1417 | return $this; |
||
| 1418 | } |
||
| 1419 | |||
| 1420 | /** |
||
| 1421 | * Get email. |
||
| 1422 | * |
||
| 1423 | * @return string |
||
| 1424 | */ |
||
| 1425 | public function getEmail() |
||
| 1426 | { |
||
| 1427 | return $this->email; |
||
| 1428 | } |
||
| 1429 | |||
| 1430 | /** |
||
| 1431 | * Set status. |
||
| 1432 | * |
||
| 1433 | * @return User |
||
| 1434 | */ |
||
| 1435 | public function setStatus(int $status) |
||
| 1436 | { |
||
| 1437 | $this->status = $status; |
||
| 1438 | |||
| 1439 | return $this; |
||
| 1440 | } |
||
| 1441 | |||
| 1442 | /** |
||
| 1443 | * Get status. |
||
| 1444 | * |
||
| 1445 | * @return int |
||
| 1446 | */ |
||
| 1447 | public function getStatus() |
||
| 1448 | { |
||
| 1449 | return (int) $this->status; |
||
| 1450 | } |
||
| 1451 | |||
| 1452 | /** |
||
| 1453 | * Set officialCode. |
||
| 1454 | * |
||
| 1455 | * @param string $officialCode |
||
| 1456 | * |
||
| 1457 | * @return User |
||
| 1458 | */ |
||
| 1459 | public function setOfficialCode($officialCode) |
||
| 1460 | { |
||
| 1461 | $this->officialCode = $officialCode; |
||
| 1462 | |||
| 1463 | return $this; |
||
| 1464 | } |
||
| 1465 | |||
| 1466 | /** |
||
| 1467 | * Get officialCode. |
||
| 1468 | * |
||
| 1469 | * @return string |
||
| 1470 | */ |
||
| 1471 | public function getOfficialCode() |
||
| 1472 | { |
||
| 1473 | return $this->officialCode; |
||
| 1474 | } |
||
| 1475 | |||
| 1476 | /** |
||
| 1477 | * Set phone. |
||
| 1478 | * |
||
| 1479 | * @param string $phone |
||
| 1480 | * |
||
| 1481 | * @return User |
||
| 1482 | */ |
||
| 1483 | public function setPhone($phone) |
||
| 1484 | { |
||
| 1485 | $this->phone = $phone; |
||
| 1486 | |||
| 1487 | return $this; |
||
| 1488 | } |
||
| 1489 | |||
| 1490 | /** |
||
| 1491 | * Get phone. |
||
| 1492 | * |
||
| 1493 | * @return string |
||
| 1494 | */ |
||
| 1495 | public function getPhone() |
||
| 1496 | { |
||
| 1497 | return $this->phone; |
||
| 1498 | } |
||
| 1499 | |||
| 1500 | /** |
||
| 1501 | * Set address. |
||
| 1502 | * |
||
| 1503 | * @param string $address |
||
| 1504 | * |
||
| 1505 | * @return User |
||
| 1506 | */ |
||
| 1507 | public function setAddress($address) |
||
| 1508 | { |
||
| 1509 | $this->address = $address; |
||
| 1510 | |||
| 1511 | return $this; |
||
| 1512 | } |
||
| 1513 | |||
| 1514 | /** |
||
| 1515 | * Get address. |
||
| 1516 | * |
||
| 1517 | * @return string |
||
| 1518 | */ |
||
| 1519 | public function getAddress() |
||
| 1520 | { |
||
| 1521 | return $this->address; |
||
| 1522 | } |
||
| 1523 | |||
| 1524 | /** |
||
| 1525 | * Set creatorId. |
||
| 1526 | * |
||
| 1527 | * @param int $creatorId |
||
| 1528 | * |
||
| 1529 | * @return User |
||
| 1530 | */ |
||
| 1531 | public function setCreatorId($creatorId) |
||
| 1532 | { |
||
| 1533 | $this->creatorId = $creatorId; |
||
| 1534 | |||
| 1535 | return $this; |
||
| 1536 | } |
||
| 1537 | |||
| 1538 | /** |
||
| 1539 | * Get creatorId. |
||
| 1540 | * |
||
| 1541 | * @return int |
||
| 1542 | */ |
||
| 1543 | public function getCreatorId() |
||
| 1544 | { |
||
| 1545 | return $this->creatorId; |
||
| 1546 | } |
||
| 1547 | |||
| 1548 | /** |
||
| 1549 | * Set competences. |
||
| 1550 | * |
||
| 1551 | * @param string $competences |
||
| 1552 | * |
||
| 1553 | * @return User |
||
| 1554 | */ |
||
| 1555 | public function setCompetences($competences) |
||
| 1556 | { |
||
| 1557 | $this->competences = $competences; |
||
| 1558 | |||
| 1559 | return $this; |
||
| 1560 | } |
||
| 1561 | |||
| 1562 | /** |
||
| 1563 | * Get competences. |
||
| 1564 | * |
||
| 1565 | * @return string |
||
| 1566 | */ |
||
| 1567 | public function getCompetences() |
||
| 1568 | { |
||
| 1569 | return $this->competences; |
||
| 1570 | } |
||
| 1571 | |||
| 1572 | /** |
||
| 1573 | * Set diplomas. |
||
| 1574 | * |
||
| 1575 | * @param string $diplomas |
||
| 1576 | * |
||
| 1577 | * @return User |
||
| 1578 | */ |
||
| 1579 | public function setDiplomas($diplomas) |
||
| 1580 | { |
||
| 1581 | $this->diplomas = $diplomas; |
||
| 1582 | |||
| 1583 | return $this; |
||
| 1584 | } |
||
| 1585 | |||
| 1586 | /** |
||
| 1587 | * Get diplomas. |
||
| 1588 | * |
||
| 1589 | * @return string |
||
| 1590 | */ |
||
| 1591 | public function getDiplomas() |
||
| 1592 | { |
||
| 1593 | return $this->diplomas; |
||
| 1594 | } |
||
| 1595 | |||
| 1596 | /** |
||
| 1597 | * Set openarea. |
||
| 1598 | * |
||
| 1599 | * @param string $openarea |
||
| 1600 | * |
||
| 1601 | * @return User |
||
| 1602 | */ |
||
| 1603 | public function setOpenarea($openarea) |
||
| 1604 | { |
||
| 1605 | $this->openarea = $openarea; |
||
| 1606 | |||
| 1607 | return $this; |
||
| 1608 | } |
||
| 1609 | |||
| 1610 | /** |
||
| 1611 | * Get openarea. |
||
| 1612 | * |
||
| 1613 | * @return string |
||
| 1614 | */ |
||
| 1615 | public function getOpenarea() |
||
| 1616 | { |
||
| 1617 | return $this->openarea; |
||
| 1618 | } |
||
| 1619 | |||
| 1620 | /** |
||
| 1621 | * Set teach. |
||
| 1622 | * |
||
| 1623 | * @param string $teach |
||
| 1624 | * |
||
| 1625 | * @return User |
||
| 1626 | */ |
||
| 1627 | public function setTeach($teach) |
||
| 1628 | { |
||
| 1629 | $this->teach = $teach; |
||
| 1630 | |||
| 1631 | return $this; |
||
| 1632 | } |
||
| 1633 | |||
| 1634 | /** |
||
| 1635 | * Get teach. |
||
| 1636 | * |
||
| 1637 | * @return string |
||
| 1638 | */ |
||
| 1639 | public function getTeach() |
||
| 1640 | { |
||
| 1641 | return $this->teach; |
||
| 1642 | } |
||
| 1643 | |||
| 1644 | /** |
||
| 1645 | * Set productions. |
||
| 1646 | * |
||
| 1647 | * @param string $productions |
||
| 1648 | * |
||
| 1649 | * @return User |
||
| 1650 | */ |
||
| 1651 | public function setProductions($productions) |
||
| 1652 | { |
||
| 1653 | $this->productions = $productions; |
||
| 1654 | |||
| 1655 | return $this; |
||
| 1656 | } |
||
| 1657 | |||
| 1658 | /** |
||
| 1659 | * Get productions. |
||
| 1660 | * |
||
| 1661 | * @return string |
||
| 1662 | */ |
||
| 1663 | public function getProductions() |
||
| 1664 | { |
||
| 1665 | return $this->productions; |
||
| 1666 | } |
||
| 1667 | |||
| 1668 | /** |
||
| 1669 | * Set language. |
||
| 1670 | * |
||
| 1671 | * @param string $language |
||
| 1672 | * |
||
| 1673 | * @return User |
||
| 1674 | */ |
||
| 1675 | public function setLanguage($language) |
||
| 1676 | { |
||
| 1677 | $this->language = $language; |
||
| 1678 | |||
| 1679 | return $this; |
||
| 1680 | } |
||
| 1681 | |||
| 1682 | /** |
||
| 1683 | * Get language. |
||
| 1684 | * |
||
| 1685 | * @return string |
||
| 1686 | */ |
||
| 1687 | public function getLanguage() |
||
| 1688 | { |
||
| 1689 | return $this->language; |
||
| 1690 | } |
||
| 1691 | |||
| 1692 | /** |
||
| 1693 | * Set registrationDate. |
||
| 1694 | * |
||
| 1695 | * @param \DateTime $registrationDate |
||
| 1696 | * |
||
| 1697 | * @return User |
||
| 1698 | */ |
||
| 1699 | public function setRegistrationDate($registrationDate) |
||
| 1700 | { |
||
| 1701 | $this->registrationDate = $registrationDate; |
||
| 1702 | |||
| 1703 | return $this; |
||
| 1704 | } |
||
| 1705 | |||
| 1706 | /** |
||
| 1707 | * Get registrationDate. |
||
| 1708 | * |
||
| 1709 | * @return \DateTime |
||
| 1710 | */ |
||
| 1711 | public function getRegistrationDate() |
||
| 1712 | { |
||
| 1713 | return $this->registrationDate; |
||
| 1714 | } |
||
| 1715 | |||
| 1716 | /** |
||
| 1717 | * Set expirationDate. |
||
| 1718 | * |
||
| 1719 | * @param \DateTime $expirationDate |
||
| 1720 | * |
||
| 1721 | * @return User |
||
| 1722 | */ |
||
| 1723 | public function setExpirationDate($expirationDate) |
||
| 1724 | { |
||
| 1725 | $this->expirationDate = $expirationDate; |
||
| 1726 | |||
| 1727 | return $this; |
||
| 1728 | } |
||
| 1729 | |||
| 1730 | /** |
||
| 1731 | * Get expirationDate. |
||
| 1732 | * |
||
| 1733 | * @return \DateTime |
||
| 1734 | */ |
||
| 1735 | public function getExpirationDate() |
||
| 1736 | { |
||
| 1737 | return $this->expirationDate; |
||
| 1738 | } |
||
| 1739 | |||
| 1740 | /** |
||
| 1741 | * Set active. |
||
| 1742 | * |
||
| 1743 | * @param bool $active |
||
| 1744 | * |
||
| 1745 | * @return User |
||
| 1746 | */ |
||
| 1747 | public function setActive($active) |
||
| 1748 | { |
||
| 1749 | $this->active = $active; |
||
| 1750 | |||
| 1751 | return $this; |
||
| 1752 | } |
||
| 1753 | |||
| 1754 | /** |
||
| 1755 | * Get active. |
||
| 1756 | * |
||
| 1757 | * @return bool |
||
| 1758 | */ |
||
| 1759 | public function getActive() |
||
| 1760 | { |
||
| 1761 | return $this->active; |
||
| 1762 | } |
||
| 1763 | |||
| 1764 | public function setOpenid($openid) |
||
| 1765 | { |
||
| 1766 | $this->openid = $openid; |
||
| 1767 | |||
| 1768 | return $this; |
||
| 1769 | } |
||
| 1770 | |||
| 1771 | /** |
||
| 1772 | * Get openid. |
||
| 1773 | * |
||
| 1774 | * @return string |
||
| 1775 | */ |
||
| 1776 | public function getOpenid() |
||
| 1777 | { |
||
| 1778 | return $this->openid; |
||
| 1779 | } |
||
| 1780 | |||
| 1781 | /** |
||
| 1782 | * Set theme. |
||
| 1783 | * |
||
| 1784 | * @param string $theme |
||
| 1785 | * |
||
| 1786 | * @return User |
||
| 1787 | */ |
||
| 1788 | public function setTheme($theme) |
||
| 1789 | { |
||
| 1790 | $this->theme = $theme; |
||
| 1791 | |||
| 1792 | return $this; |
||
| 1793 | } |
||
| 1794 | |||
| 1795 | /** |
||
| 1796 | * Get theme. |
||
| 1797 | * |
||
| 1798 | * @return string |
||
| 1799 | */ |
||
| 1800 | public function getTheme() |
||
| 1801 | { |
||
| 1802 | return $this->theme; |
||
| 1803 | } |
||
| 1804 | |||
| 1805 | /** |
||
| 1806 | * Set hrDeptId. |
||
| 1807 | * |
||
| 1808 | * @param int $hrDeptId |
||
| 1809 | * |
||
| 1810 | * @return User |
||
| 1811 | */ |
||
| 1812 | public function setHrDeptId($hrDeptId) |
||
| 1813 | { |
||
| 1814 | $this->hrDeptId = $hrDeptId; |
||
| 1815 | |||
| 1816 | return $this; |
||
| 1817 | } |
||
| 1818 | |||
| 1819 | /** |
||
| 1820 | * Get hrDeptId. |
||
| 1821 | * |
||
| 1822 | * @return int |
||
| 1823 | */ |
||
| 1824 | public function getHrDeptId() |
||
| 1825 | { |
||
| 1826 | return $this->hrDeptId; |
||
| 1827 | } |
||
| 1828 | |||
| 1829 | /** |
||
| 1830 | * @return \DateTime |
||
| 1831 | */ |
||
| 1832 | public function getMemberSince() |
||
| 1833 | { |
||
| 1834 | return $this->registrationDate; |
||
| 1835 | } |
||
| 1836 | |||
| 1837 | /** |
||
| 1838 | * @return bool |
||
| 1839 | */ |
||
| 1840 | public function isOnline() |
||
| 1841 | { |
||
| 1842 | return false; |
||
| 1843 | } |
||
| 1844 | |||
| 1845 | /** |
||
| 1846 | * @return int |
||
| 1847 | */ |
||
| 1848 | public function getIdentifier() |
||
| 1849 | { |
||
| 1850 | return $this->getId(); |
||
| 1851 | } |
||
| 1852 | |||
| 1853 | /** |
||
| 1854 | * @return string |
||
| 1855 | */ |
||
| 1856 | public function getSlug() |
||
| 1857 | { |
||
| 1858 | return $this->getUsername(); |
||
| 1859 | } |
||
| 1860 | |||
| 1861 | /** |
||
| 1862 | * @param string $slug |
||
| 1863 | * |
||
| 1864 | * @return User |
||
| 1865 | */ |
||
| 1866 | public function setSlug($slug) |
||
| 1867 | { |
||
| 1868 | return $this->setUsername($slug); |
||
| 1869 | } |
||
| 1870 | |||
| 1871 | public function setUsername($username) |
||
| 1872 | { |
||
| 1873 | $this->username = $username; |
||
| 1874 | |||
| 1875 | return $this; |
||
| 1876 | } |
||
| 1877 | |||
| 1878 | public function setUsernameCanonical($usernameCanonical) |
||
| 1879 | { |
||
| 1880 | $this->usernameCanonical = $usernameCanonical; |
||
| 1881 | |||
| 1882 | return $this; |
||
| 1883 | } |
||
| 1884 | |||
| 1885 | public function setEmailCanonical($emailCanonical) |
||
| 1886 | { |
||
| 1887 | $this->emailCanonical = $emailCanonical; |
||
| 1888 | |||
| 1889 | return $this; |
||
| 1890 | } |
||
| 1891 | |||
| 1892 | /** |
||
| 1893 | * Set lastLogin. |
||
| 1894 | * |
||
| 1895 | * @param \DateTime $lastLogin |
||
| 1896 | * |
||
| 1897 | * @return User |
||
| 1898 | */ |
||
| 1899 | public function setLastLogin(\DateTime $lastLogin = null) |
||
| 1900 | { |
||
| 1901 | $this->lastLogin = $lastLogin; |
||
| 1902 | |||
| 1903 | return $this; |
||
| 1904 | } |
||
| 1905 | |||
| 1906 | /** |
||
| 1907 | * Get lastLogin. |
||
| 1908 | * |
||
| 1909 | * @return \DateTime |
||
| 1910 | */ |
||
| 1911 | public function getLastLogin() |
||
| 1912 | { |
||
| 1913 | return $this->lastLogin; |
||
| 1914 | } |
||
| 1915 | |||
| 1916 | /** |
||
| 1917 | * Get sessionCourseSubscription. |
||
| 1918 | * |
||
| 1919 | * @return ArrayCollection |
||
| 1920 | */ |
||
| 1921 | public function getSessionCourseSubscriptions() |
||
| 1922 | { |
||
| 1923 | return $this->sessionCourseSubscriptions; |
||
| 1924 | } |
||
| 1925 | |||
| 1926 | /** |
||
| 1927 | * @param $value |
||
| 1928 | * @param string[][] $value |
||
| 1929 | * |
||
| 1930 | * @return $this |
||
| 1931 | */ |
||
| 1932 | public function setSessionCourseSubscriptions(array $value) |
||
| 1933 | { |
||
| 1934 | $this->sessionCourseSubscriptions = $value; |
||
| 1935 | |||
| 1936 | return $this; |
||
| 1937 | } |
||
| 1938 | |||
| 1939 | /** |
||
| 1940 | * @return string |
||
| 1941 | */ |
||
| 1942 | public function getConfirmationToken() |
||
| 1943 | { |
||
| 1944 | return $this->confirmationToken; |
||
| 1945 | } |
||
| 1946 | |||
| 1947 | /** |
||
| 1948 | * @param string $confirmationToken |
||
| 1949 | * |
||
| 1950 | * @return User |
||
| 1951 | */ |
||
| 1952 | public function setConfirmationToken($confirmationToken) |
||
| 1953 | { |
||
| 1954 | $this->confirmationToken = $confirmationToken; |
||
| 1955 | |||
| 1956 | return $this; |
||
| 1957 | } |
||
| 1958 | |||
| 1959 | /** |
||
| 1960 | * @return \DateTime |
||
| 1961 | */ |
||
| 1962 | public function getPasswordRequestedAt() |
||
| 1963 | { |
||
| 1964 | return $this->passwordRequestedAt; |
||
| 1965 | } |
||
| 1966 | |||
| 1967 | /*public function isPasswordRequestNonExpired($ttl) |
||
| 1968 | { |
||
| 1969 | return $this->getPasswordRequestedAt() instanceof \DateTime && |
||
| 1970 | $this->getPasswordRequestedAt()->getTimestamp() + $ttl > time(); |
||
| 1971 | }*/ |
||
| 1972 | |||
| 1973 | public function getUsername(): string |
||
| 1974 | { |
||
| 1975 | return (string) $this->username; |
||
| 1976 | } |
||
| 1977 | |||
| 1978 | public function getPlainPassword(): ?string |
||
| 1979 | { |
||
| 1980 | return $this->plainPassword; |
||
| 1981 | } |
||
| 1982 | |||
| 1983 | public function setPlainPassword(string $password) |
||
| 1984 | { |
||
| 1985 | $this->plainPassword = $password; |
||
| 1986 | |||
| 1987 | // forces the object to look "dirty" to Doctrine. Avoids |
||
| 1988 | // Doctrine *not* saving this entity, if only plainPassword changes |
||
| 1989 | $this->password = null; |
||
| 1990 | |||
| 1991 | return $this; |
||
| 1992 | } |
||
| 1993 | |||
| 1994 | /** |
||
| 1995 | * Returns the expiration date. |
||
| 1996 | * |
||
| 1997 | * @return \DateTime|null |
||
| 1998 | */ |
||
| 1999 | public function getExpiresAt() |
||
| 2000 | { |
||
| 2001 | return $this->expiresAt; |
||
| 2002 | } |
||
| 2003 | |||
| 2004 | /** |
||
| 2005 | * Returns the credentials expiration date. |
||
| 2006 | * |
||
| 2007 | * @return \DateTime |
||
| 2008 | */ |
||
| 2009 | public function getCredentialsExpireAt() |
||
| 2010 | { |
||
| 2011 | return $this->credentialsExpireAt; |
||
| 2012 | } |
||
| 2013 | |||
| 2014 | /** |
||
| 2015 | * Sets the credentials expiration date. |
||
| 2016 | * |
||
| 2017 | * @return User |
||
| 2018 | */ |
||
| 2019 | public function setCredentialsExpireAt(\DateTime $date = null) |
||
| 2020 | { |
||
| 2021 | $this->credentialsExpireAt = $date; |
||
| 2022 | |||
| 2023 | return $this; |
||
| 2024 | } |
||
| 2025 | |||
| 2026 | public function addGroup($group) |
||
| 2027 | { |
||
| 2028 | if (!$this->getGroups()->contains($group)) { |
||
| 2029 | $this->getGroups()->add($group); |
||
| 2030 | } |
||
| 2031 | |||
| 2032 | return $this; |
||
| 2033 | } |
||
| 2034 | |||
| 2035 | /** |
||
| 2036 | * Sets the user groups. |
||
| 2037 | * |
||
| 2038 | * @param array $groups |
||
| 2039 | * |
||
| 2040 | * @return User |
||
| 2041 | */ |
||
| 2042 | public function setGroups($groups) |
||
| 2043 | { |
||
| 2044 | foreach ($groups as $group) { |
||
| 2045 | $this->addGroup($group); |
||
| 2046 | } |
||
| 2047 | |||
| 2048 | return $this; |
||
| 2049 | } |
||
| 2050 | |||
| 2051 | /** |
||
| 2052 | * @return string |
||
| 2053 | */ |
||
| 2054 | public function getFullname() |
||
| 2055 | { |
||
| 2056 | return sprintf('%s %s', $this->getFirstname(), $this->getLastname()); |
||
| 2057 | } |
||
| 2058 | |||
| 2059 | public function getGroups() |
||
| 2060 | { |
||
| 2061 | return $this->groups; |
||
| 2062 | } |
||
| 2063 | |||
| 2064 | /** |
||
| 2065 | * @return array |
||
| 2066 | */ |
||
| 2067 | public function getGroupNames() |
||
| 2068 | { |
||
| 2069 | $names = []; |
||
| 2070 | foreach ($this->getGroups() as $group) { |
||
| 2071 | $names[] = $group->getName(); |
||
| 2072 | } |
||
| 2073 | |||
| 2074 | return $names; |
||
| 2075 | } |
||
| 2076 | |||
| 2077 | /** |
||
| 2078 | * @param string $name |
||
| 2079 | * |
||
| 2080 | * @return bool |
||
| 2081 | */ |
||
| 2082 | public function hasGroup($name) |
||
| 2083 | { |
||
| 2084 | return in_array($name, $this->getGroupNames()); |
||
| 2085 | } |
||
| 2086 | |||
| 2087 | public function removeGroup($group) |
||
| 2088 | { |
||
| 2089 | if ($this->getGroups()->contains($group)) { |
||
| 2090 | $this->getGroups()->removeElement($group); |
||
| 2091 | } |
||
| 2092 | |||
| 2093 | return $this; |
||
| 2094 | } |
||
| 2095 | |||
| 2096 | /** |
||
| 2097 | * @param string $role |
||
| 2098 | * |
||
| 2099 | * @return $this |
||
| 2100 | */ |
||
| 2101 | public function addRole($role) |
||
| 2102 | { |
||
| 2103 | $role = strtoupper($role); |
||
| 2104 | if ($role === static::ROLE_DEFAULT) { |
||
| 2105 | return $this; |
||
| 2106 | } |
||
| 2107 | |||
| 2108 | if (!in_array($role, $this->roles, true)) { |
||
| 2109 | $this->roles[] = $role; |
||
| 2110 | } |
||
| 2111 | |||
| 2112 | return $this; |
||
| 2113 | } |
||
| 2114 | |||
| 2115 | /** |
||
| 2116 | * Returns the user roles. |
||
| 2117 | * |
||
| 2118 | * @return array The roles |
||
| 2119 | */ |
||
| 2120 | public function getRoles() |
||
| 2121 | { |
||
| 2122 | $roles = $this->roles; |
||
| 2123 | |||
| 2124 | foreach ($this->getGroups() as $group) { |
||
| 2125 | $roles = array_merge($roles, $group->getRoles()); |
||
| 2126 | } |
||
| 2127 | |||
| 2128 | // we need to make sure to have at least one role |
||
| 2129 | $roles[] = 'ROLE_USER'; |
||
| 2130 | |||
| 2131 | return array_unique($roles); |
||
| 2132 | } |
||
| 2133 | |||
| 2134 | public function isAccountNonExpired() |
||
| 2135 | { |
||
| 2136 | /*if (true === $this->expired) { |
||
| 2137 | return false; |
||
| 2138 | } |
||
| 2139 | |||
| 2140 | if (null !== $this->expiresAt && $this->expiresAt->getTimestamp() < time()) { |
||
| 2141 | return false; |
||
| 2142 | }*/ |
||
| 2143 | |||
| 2144 | return true; |
||
| 2145 | } |
||
| 2146 | |||
| 2147 | public function isAccountNonLocked() |
||
| 2148 | { |
||
| 2149 | return true; |
||
| 2150 | //return !$this->locked; |
||
| 2151 | } |
||
| 2152 | |||
| 2153 | public function isCredentialsNonExpired() |
||
| 2154 | { |
||
| 2155 | /*if (true === $this->credentialsExpired) { |
||
| 2156 | return false; |
||
| 2157 | } |
||
| 2158 | |||
| 2159 | if (null !== $this->credentialsExpireAt && $this->credentialsExpireAt->getTimestamp() < time()) { |
||
| 2160 | return false; |
||
| 2161 | }*/ |
||
| 2162 | |||
| 2163 | return true; |
||
| 2164 | } |
||
| 2165 | |||
| 2166 | /** |
||
| 2167 | * @return bool |
||
| 2168 | */ |
||
| 2169 | public function getCredentialsExpired() |
||
| 2170 | { |
||
| 2171 | return $this->credentialsExpired; |
||
| 2172 | } |
||
| 2173 | |||
| 2174 | /** |
||
| 2175 | * @param bool $boolean |
||
| 2176 | * |
||
| 2177 | * @return User |
||
| 2178 | */ |
||
| 2179 | public function setCredentialsExpired($boolean) |
||
| 2180 | { |
||
| 2181 | $this->credentialsExpired = $boolean; |
||
| 2182 | |||
| 2183 | return $this; |
||
| 2184 | } |
||
| 2185 | |||
| 2186 | /** |
||
| 2187 | * @param $boolean |
||
| 2188 | * |
||
| 2189 | * @return $this |
||
| 2190 | */ |
||
| 2191 | public function setEnabled($boolean) |
||
| 2192 | { |
||
| 2193 | $this->enabled = (bool) $boolean; |
||
| 2194 | |||
| 2195 | return $this; |
||
| 2196 | } |
||
| 2197 | |||
| 2198 | /** |
||
| 2199 | * @return bool |
||
| 2200 | */ |
||
| 2201 | public function getExpired() |
||
| 2202 | { |
||
| 2203 | return $this->expired; |
||
| 2204 | } |
||
| 2205 | |||
| 2206 | /** |
||
| 2207 | * Sets this user to expired. |
||
| 2208 | * |
||
| 2209 | * @param bool $boolean |
||
| 2210 | * |
||
| 2211 | * @return User |
||
| 2212 | */ |
||
| 2213 | public function setExpired($boolean) |
||
| 2214 | { |
||
| 2215 | $this->expired = (bool) $boolean; |
||
| 2216 | |||
| 2217 | return $this; |
||
| 2218 | } |
||
| 2219 | |||
| 2220 | /** |
||
| 2221 | * @return User |
||
| 2222 | */ |
||
| 2223 | public function setExpiresAt(\DateTime $date) |
||
| 2224 | { |
||
| 2225 | $this->expiresAt = $date; |
||
| 2226 | |||
| 2227 | return $this; |
||
| 2228 | } |
||
| 2229 | |||
| 2230 | public function getLocked(): bool |
||
| 2231 | { |
||
| 2232 | return $this->locked; |
||
| 2233 | } |
||
| 2234 | |||
| 2235 | /** |
||
| 2236 | * @param $boolean |
||
| 2237 | * |
||
| 2238 | * @return $this |
||
| 2239 | */ |
||
| 2240 | public function setLocked($boolean) |
||
| 2241 | { |
||
| 2242 | $this->locked = $boolean; |
||
| 2243 | |||
| 2244 | return $this; |
||
| 2245 | } |
||
| 2246 | |||
| 2247 | /** |
||
| 2248 | * @return $this |
||
| 2249 | */ |
||
| 2250 | public function setRoles(array $roles) |
||
| 2251 | { |
||
| 2252 | $this->roles = []; |
||
| 2253 | |||
| 2254 | foreach ($roles as $role) { |
||
| 2255 | $this->addRole($role); |
||
| 2256 | } |
||
| 2257 | |||
| 2258 | return $this; |
||
| 2259 | } |
||
| 2260 | |||
| 2261 | /** |
||
| 2262 | * Get achievedSkills. |
||
| 2263 | * |
||
| 2264 | * @return ArrayCollection |
||
| 2265 | */ |
||
| 2266 | public function getAchievedSkills() |
||
| 2267 | { |
||
| 2268 | return $this->achievedSkills; |
||
| 2269 | } |
||
| 2270 | |||
| 2271 | /** |
||
| 2272 | * @param $value |
||
| 2273 | * @param string[] $value |
||
| 2274 | * |
||
| 2275 | * @return $this |
||
| 2276 | */ |
||
| 2277 | public function setAchievedSkills(array $value) |
||
| 3448 |