| Total Complexity | 121 |
| Total Lines | 1270 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
Complex classes like Course 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 Course, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 46 | #[ApiFilter(SearchFilter::class, properties: [ |
||
| 47 | 'title' => 'partial', |
||
| 48 | 'code' => 'partial', |
||
| 49 | ])] |
||
| 50 | #[ApiFilter(PropertyFilter::class)] |
||
| 51 | #[ApiFilter(OrderFilter::class, properties: ['id', 'title'])] |
||
| 52 | |||
| 53 | class Course extends AbstractResource implements ResourceInterface, ResourceWithAccessUrlInterface, ResourceIllustrationInterface |
||
| 54 | { |
||
| 55 | public const CLOSED = 0; |
||
| 56 | public const REGISTERED = 1; // Only registered users in the course. |
||
| 57 | public const OPEN_PLATFORM = 2; // All users registered in the platform (default). |
||
| 58 | public const OPEN_WORLD = 3; |
||
| 59 | public const HIDDEN = 4; |
||
| 60 | |||
| 61 | /** |
||
| 62 | * @Groups({"course:read", "course_rel_user:read", "session_rel_user:read", "session_rel_course_rel_user:read", "session_rel_user:read"}) |
||
| 63 | * @ORM\Column(name="id", type="integer") |
||
| 64 | * @ORM\Id |
||
| 65 | * @ORM\GeneratedValue(strategy="AUTO") |
||
| 66 | */ |
||
| 67 | protected ?int $id = null; |
||
| 68 | |||
| 69 | /** |
||
| 70 | * The course title. |
||
| 71 | * |
||
| 72 | * @Groups({"course:read", "course:write", "course_rel_user:read", "session_rel_course_rel_user:read", "session_rel_user:read"}) |
||
| 73 | * |
||
| 74 | * @ORM\Column(name="title", type="string", length=250, nullable=true, unique=false) |
||
| 75 | */ |
||
| 76 | #[Assert\NotBlank(message: 'A Course requires a title')] |
||
| 77 | protected ?string $title = null; |
||
| 78 | |||
| 79 | /** |
||
| 80 | * The course code. |
||
| 81 | * |
||
| 82 | * @Assert\Length( |
||
| 83 | * max = 40, |
||
| 84 | * maxMessage = "Code cannot be longer than {{ limit }} characters" |
||
| 85 | * ) |
||
| 86 | * @ApiProperty(iri="http://schema.org/courseCode") |
||
| 87 | * @Groups({"course:read", "course:write", "course_rel_user:read"}) |
||
| 88 | * |
||
| 89 | * @Gedmo\Slug( |
||
| 90 | * fields={"title"}, |
||
| 91 | * updatable=false, |
||
| 92 | * unique=true, |
||
| 93 | * separator="", |
||
| 94 | * style="upper" |
||
| 95 | * ) |
||
| 96 | * @ORM\Column(name="code", type="string", length=40, nullable=false, unique=true) |
||
| 97 | */ |
||
| 98 | #[Assert\NotBlank] |
||
| 99 | protected string $code; |
||
| 100 | |||
| 101 | /** |
||
| 102 | * @Assert\Length( |
||
| 103 | * max = 40, |
||
| 104 | * maxMessage = "Code cannot be longer than {{ limit }} characters" |
||
| 105 | * ) |
||
| 106 | * @ORM\Column(name="visual_code", type="string", length=40, nullable=true, unique=false) |
||
| 107 | */ |
||
| 108 | protected ?string $visualCode = null; |
||
| 109 | |||
| 110 | /** |
||
| 111 | * @var Collection|CourseRelUser[] |
||
| 112 | * |
||
| 113 | * @Groups({"course:read", "user:read"}) |
||
| 114 | * "orphanRemoval" is needed to delete the CourseRelUser relation |
||
| 115 | * in the CourseAdmin class. The setUsers, getUsers, removeUsers and |
||
| 116 | * addUsers methods need to be added. |
||
| 117 | * |
||
| 118 | * @ORM\OneToMany(targetEntity="CourseRelUser", mappedBy="course", cascade={"persist"}, orphanRemoval=true) |
||
| 119 | */ |
||
| 120 | #[ApiSubresource] |
||
| 121 | protected Collection $users; |
||
| 122 | |||
| 123 | /** |
||
| 124 | * @var AccessUrlRelCourse[]|Collection |
||
| 125 | * |
||
| 126 | * @ORM\OneToMany( |
||
| 127 | * targetEntity="Chamilo\CoreBundle\Entity\AccessUrlRelCourse", |
||
| 128 | * mappedBy="course", cascade={"persist", "remove"}, orphanRemoval=true |
||
| 129 | * ) |
||
| 130 | */ |
||
| 131 | protected Collection $urls; |
||
| 132 | |||
| 133 | /** |
||
| 134 | * @var Collection|SessionRelCourse[] |
||
| 135 | * |
||
| 136 | * @ORM\OneToMany(targetEntity="SessionRelCourse", mappedBy="course", cascade={"persist", "remove"}) |
||
| 137 | */ |
||
| 138 | protected Collection $sessions; |
||
| 139 | |||
| 140 | /** |
||
| 141 | * @var Collection|SessionRelCourseRelUser[] |
||
| 142 | * |
||
| 143 | * @ORM\OneToMany(targetEntity="SessionRelCourseRelUser", mappedBy="course", cascade={"persist", "remove"}) |
||
| 144 | */ |
||
| 145 | protected Collection $sessionRelCourseRelUsers; |
||
| 146 | |||
| 147 | /** |
||
| 148 | * @var Collection|CTool[] |
||
| 149 | * |
||
| 150 | * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CTool", mappedBy="course", cascade={"persist", "remove"}) |
||
| 151 | */ |
||
| 152 | protected Collection $tools; |
||
| 153 | |||
| 154 | protected Session $currentSession; |
||
| 155 | |||
| 156 | protected AccessUrl $currentUrl; |
||
| 157 | |||
| 158 | /** |
||
| 159 | * @var Collection|SkillRelCourse[] |
||
| 160 | * |
||
| 161 | * @ORM\OneToMany(targetEntity="SkillRelCourse", mappedBy="course", cascade={"persist", "remove"}) |
||
| 162 | */ |
||
| 163 | protected Collection $skills; |
||
| 164 | |||
| 165 | /** |
||
| 166 | * @var Collection|SkillRelUser[] |
||
| 167 | * |
||
| 168 | * @ORM\OneToMany(targetEntity="SkillRelUser", mappedBy="course", cascade={"persist", "remove"}) |
||
| 169 | */ |
||
| 170 | protected Collection $issuedSkills; |
||
| 171 | |||
| 172 | /** |
||
| 173 | * @var Collection|GradebookCategory[] |
||
| 174 | * |
||
| 175 | * @ORM\OneToMany(targetEntity="GradebookCategory", mappedBy="course", cascade={"persist", "remove"}) |
||
| 176 | */ |
||
| 177 | protected Collection $gradebookCategories; |
||
| 178 | |||
| 179 | /** |
||
| 180 | * @var Collection|GradebookEvaluation[] |
||
| 181 | * |
||
| 182 | * @ORM\OneToMany(targetEntity="GradebookEvaluation", mappedBy="course", cascade={"persist", "remove"}) |
||
| 183 | */ |
||
| 184 | protected Collection $gradebookEvaluations; |
||
| 185 | |||
| 186 | /** |
||
| 187 | * @var Collection|GradebookLink[] |
||
| 188 | * |
||
| 189 | * @ORM\OneToMany(targetEntity="GradebookLink", mappedBy="course", cascade={"persist", "remove"}) |
||
| 190 | */ |
||
| 191 | protected Collection $gradebookLinks; |
||
| 192 | |||
| 193 | /** |
||
| 194 | * @var Collection|TrackEHotspot[] |
||
| 195 | * |
||
| 196 | * @ORM\OneToMany(targetEntity="TrackEHotspot", mappedBy="course", cascade={"persist", "remove"}) |
||
| 197 | */ |
||
| 198 | protected Collection $trackEHotspots; |
||
| 199 | |||
| 200 | /** |
||
| 201 | * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\SearchEngineRef", mappedBy="course", cascade={"persist", "remove"}) |
||
| 202 | * |
||
| 203 | * @var SearchEngineRef[]|Collection |
||
| 204 | */ |
||
| 205 | protected Collection $searchEngineRefs; |
||
| 206 | |||
| 207 | /** |
||
| 208 | * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\Templates", mappedBy="course", cascade={"persist", "remove"}) |
||
| 209 | * |
||
| 210 | * @var Templates[]|Collection |
||
| 211 | */ |
||
| 212 | protected Collection $templates; |
||
| 213 | |||
| 214 | /** |
||
| 215 | * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\SpecificFieldValues", mappedBy="course") |
||
| 216 | */ |
||
| 217 | //protected $specificFieldValues; |
||
| 218 | |||
| 219 | /** |
||
| 220 | * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\SharedSurvey", mappedBy="course") |
||
| 221 | */ |
||
| 222 | //protected $sharedSurveys; |
||
| 223 | |||
| 224 | /** |
||
| 225 | * @ORM\Column(name="directory", type="string", length=40, nullable=true, unique=false) |
||
| 226 | */ |
||
| 227 | protected ?string $directory = null; |
||
| 228 | |||
| 229 | /** |
||
| 230 | * @Groups({"course:read", "list"}) |
||
| 231 | * @ORM\Column(name="course_language", type="string", length=20, nullable=false, unique=false) |
||
| 232 | */ |
||
| 233 | protected string $courseLanguage; |
||
| 234 | |||
| 235 | /** |
||
| 236 | * @Groups({"course:read", "course_rel_user:read"}) |
||
| 237 | * |
||
| 238 | * @ORM\Column(name="description", type="text", nullable=true, unique=false) |
||
| 239 | */ |
||
| 240 | protected ?string $description; |
||
| 241 | |||
| 242 | /** |
||
| 243 | * @Groups({"course:read", "course_rel_user:read"}) |
||
| 244 | * |
||
| 245 | * @ORM\Column(name="introduction", type="text", nullable=true) |
||
| 246 | */ |
||
| 247 | protected ?string $introduction; |
||
| 248 | |||
| 249 | /** |
||
| 250 | * @Groups({"course:read", "course:write", "course_rel_user:read"}) |
||
| 251 | * |
||
| 252 | * @var CourseCategory[]|Collection |
||
| 253 | * |
||
| 254 | * @ORM\ManyToMany(targetEntity="Chamilo\CoreBundle\Entity\CourseCategory", inversedBy="courses") |
||
| 255 | * @ORM\JoinTable( |
||
| 256 | * name="course_rel_category", |
||
| 257 | * joinColumns={ |
||
| 258 | * @ORM\JoinColumn(name="course_id", referencedColumnName="id") |
||
| 259 | * }, |
||
| 260 | * inverseJoinColumns={ |
||
| 261 | * @ORM\JoinColumn(name="course_category_id", referencedColumnName="id")} |
||
| 262 | * ) |
||
| 263 | */ |
||
| 264 | #[ApiSubresource] |
||
| 265 | protected Collection $categories; |
||
| 266 | |||
| 267 | /** |
||
| 268 | * @var int Course visibility |
||
| 269 | * |
||
| 270 | * @Groups({"course:read", "course:write"}) |
||
| 271 | * |
||
| 272 | * @ORM\Column(name="visibility", type="integer", nullable=false, unique=false) |
||
| 273 | */ |
||
| 274 | #[Assert\NotBlank] |
||
| 275 | protected int $visibility; |
||
| 276 | |||
| 277 | /** |
||
| 278 | * @ORM\Column(name="show_score", type="integer", nullable=true, unique=false) |
||
| 279 | */ |
||
| 280 | protected ?int $showScore = null; |
||
| 281 | |||
| 282 | /** |
||
| 283 | * @ORM\Column(name="tutor_name", type="string", length=200, nullable=true, unique=false) |
||
| 284 | */ |
||
| 285 | protected ?string $tutorName; |
||
| 286 | |||
| 287 | /** |
||
| 288 | * @Groups({"course:read", "list"}) |
||
| 289 | * @ORM\Column(name="department_name", type="string", length=30, nullable=true, unique=false) |
||
| 290 | */ |
||
| 291 | protected ?string $departmentName = null; |
||
| 292 | |||
| 293 | /** |
||
| 294 | * @Groups({"course:read", "list"}) |
||
| 295 | * @Assert\Url() |
||
| 296 | * |
||
| 297 | * @ORM\Column(name="department_url", type="string", length=180, nullable=true, unique=false) |
||
| 298 | */ |
||
| 299 | protected ?string $departmentUrl = null; |
||
| 300 | |||
| 301 | /** |
||
| 302 | * @ORM\Column(name="disk_quota", type="bigint", nullable=true, unique=false) |
||
| 303 | */ |
||
| 304 | protected ?int $diskQuota = null; |
||
| 305 | |||
| 306 | /** |
||
| 307 | * @ORM\Column(name="last_visit", type="datetime", nullable=true, unique=false) |
||
| 308 | */ |
||
| 309 | protected ?DateTime $lastVisit; |
||
| 310 | |||
| 311 | /** |
||
| 312 | * @ORM\Column(name="last_edit", type="datetime", nullable=true, unique=false) |
||
| 313 | */ |
||
| 314 | protected ?DateTime $lastEdit; |
||
| 315 | |||
| 316 | /** |
||
| 317 | * @ORM\Column(name="creation_date", type="datetime", nullable=false, unique=false) |
||
| 318 | */ |
||
| 319 | protected DateTime $creationDate; |
||
| 320 | |||
| 321 | /** |
||
| 322 | * @Groups({"course:read", "list"}) |
||
| 323 | * @ORM\Column(name="expiration_date", type="datetime", nullable=true, unique=false) |
||
| 324 | */ |
||
| 325 | protected ?DateTime $expirationDate = null; |
||
| 326 | |||
| 327 | /** |
||
| 328 | * @ORM\Column(name="subscribe", type="boolean", nullable=false, unique=false) |
||
| 329 | */ |
||
| 330 | protected bool $subscribe; |
||
| 331 | |||
| 332 | /** |
||
| 333 | * @ORM\Column(name="unsubscribe", type="boolean", nullable=false, unique=false) |
||
| 334 | */ |
||
| 335 | protected bool $unsubscribe; |
||
| 336 | |||
| 337 | /** |
||
| 338 | * @ORM\Column(name="registration_code", type="string", length=255, nullable=true, unique=false) |
||
| 339 | */ |
||
| 340 | protected ?string $registrationCode; |
||
| 341 | |||
| 342 | /** |
||
| 343 | * @ORM\Column(name="legal", type="text", nullable=true, unique=false) |
||
| 344 | */ |
||
| 345 | protected ?string $legal; |
||
| 346 | |||
| 347 | /** |
||
| 348 | * @ORM\Column(name="activate_legal", type="integer", nullable=true, unique=false) |
||
| 349 | */ |
||
| 350 | protected ?int $activateLegal; |
||
| 351 | |||
| 352 | /** |
||
| 353 | * @ORM\Column(name="add_teachers_to_sessions_courses", type="boolean", nullable=true) |
||
| 354 | */ |
||
| 355 | protected ?bool $addTeachersToSessionsCourses; |
||
| 356 | |||
| 357 | /** |
||
| 358 | * @ORM\Column(name="course_type_id", type="integer", nullable=true, unique=false) |
||
| 359 | */ |
||
| 360 | protected ?int $courseTypeId; |
||
| 361 | |||
| 362 | /** |
||
| 363 | * ORM\OneToMany(targetEntity="CurriculumCategory", mappedBy="course"). |
||
| 364 | */ |
||
| 365 | //protected $curriculumCategories; |
||
| 366 | |||
| 367 | /** |
||
| 368 | * @ORM\ManyToOne(targetEntity="Room") |
||
| 369 | * @ORM\JoinColumn(name="room_id", referencedColumnName="id") |
||
| 370 | */ |
||
| 371 | protected ?Room $room; |
||
| 372 | |||
| 373 | public function __construct() |
||
| 374 | { |
||
| 375 | $this->visibility = self::OPEN_PLATFORM; |
||
| 376 | $this->sessions = new ArrayCollection(); |
||
| 377 | $this->sessionRelCourseRelUsers = new ArrayCollection(); |
||
| 378 | $this->skills = new ArrayCollection(); |
||
| 379 | $this->issuedSkills = new ArrayCollection(); |
||
| 380 | $this->creationDate = new DateTime(); |
||
| 381 | $this->lastVisit = new DateTime(); |
||
| 382 | $this->lastEdit = new DateTime(); |
||
| 383 | $this->description = ''; |
||
| 384 | $this->introduction = ''; |
||
| 385 | $this->tutorName = ''; |
||
| 386 | $this->registrationCode = null; |
||
| 387 | $this->legal = ''; |
||
| 388 | $this->users = new ArrayCollection(); |
||
| 389 | $this->urls = new ArrayCollection(); |
||
| 390 | $this->tools = new ArrayCollection(); |
||
| 391 | $this->categories = new ArrayCollection(); |
||
| 392 | $this->gradebookCategories = new ArrayCollection(); |
||
| 393 | $this->gradebookEvaluations = new ArrayCollection(); |
||
| 394 | $this->gradebookLinks = new ArrayCollection(); |
||
| 395 | $this->trackEHotspots = new ArrayCollection(); |
||
| 396 | |||
| 397 | $this->searchEngineRefs = new ArrayCollection(); |
||
| 398 | $this->templates = new ArrayCollection(); |
||
| 399 | $this->activateLegal = 0; |
||
| 400 | $this->addTeachersToSessionsCourses = false; |
||
| 401 | $this->courseTypeId = null; |
||
| 402 | $this->room = null; |
||
| 403 | $this->courseLanguage = 'en'; |
||
| 404 | $this->subscribe = true; |
||
| 405 | $this->unsubscribe = false; |
||
| 406 | //$this->specificFieldValues = new ArrayCollection(); |
||
| 407 | //$this->sharedSurveys = new ArrayCollection(); |
||
| 408 | } |
||
| 409 | |||
| 410 | public function __toString(): string |
||
| 411 | { |
||
| 412 | return $this->getTitle(); |
||
| 413 | } |
||
| 414 | |||
| 415 | /** |
||
| 416 | * @return SessionRelCourse[]|ArrayCollection|Collection |
||
| 417 | */ |
||
| 418 | public function getSessions() |
||
| 419 | { |
||
| 420 | return $this->sessions; |
||
| 421 | } |
||
| 422 | |||
| 423 | /** |
||
| 424 | * @return CTool[]|ArrayCollection|Collection |
||
| 425 | */ |
||
| 426 | public function getTools() |
||
| 427 | { |
||
| 428 | return $this->tools; |
||
| 429 | } |
||
| 430 | |||
| 431 | public function setTools(array $tools): self |
||
| 432 | { |
||
| 433 | foreach ($tools as $tool) { |
||
| 434 | $this->addTool($tool); |
||
| 435 | } |
||
| 436 | |||
| 437 | return $this; |
||
| 438 | } |
||
| 439 | |||
| 440 | public function addTool(CTool $tool): self |
||
| 441 | { |
||
| 442 | $tool->setCourse($this); |
||
| 443 | $this->tools->add($tool); |
||
| 444 | |||
| 445 | return $this; |
||
| 446 | } |
||
| 447 | |||
| 448 | /** |
||
| 449 | * @return AccessUrlRelCourse[]|Collection |
||
| 450 | */ |
||
| 451 | public function getUrls() |
||
| 452 | { |
||
| 453 | return $this->urls; |
||
| 454 | } |
||
| 455 | |||
| 456 | public function setUrls(Collection $urls): self |
||
| 457 | { |
||
| 458 | $this->urls = new ArrayCollection(); |
||
| 459 | foreach ($urls as $url) { |
||
| 460 | $this->addAccessUrl($url); |
||
| 461 | } |
||
| 462 | |||
| 463 | return $this; |
||
| 464 | } |
||
| 465 | |||
| 466 | public function addUrlRelCourse(AccessUrlRelCourse $accessUrlRelCourse): self |
||
| 467 | { |
||
| 468 | $accessUrlRelCourse->setCourse($this); |
||
| 469 | $this->urls->add($accessUrlRelCourse); |
||
| 470 | |||
| 471 | return $this; |
||
| 472 | } |
||
| 473 | |||
| 474 | public function addAccessUrl(AccessUrl $url): self |
||
| 475 | { |
||
| 476 | $urlRelCourse = (new AccessUrlRelCourse()) |
||
| 477 | ->setCourse($this) |
||
| 478 | ->setUrl($url) |
||
| 479 | ; |
||
| 480 | $this->addUrlRelCourse($urlRelCourse); |
||
| 481 | |||
| 482 | return $this; |
||
| 483 | } |
||
| 484 | |||
| 485 | /** |
||
| 486 | * @return Collection|CourseRelUser[] |
||
| 487 | */ |
||
| 488 | public function getUsers() |
||
| 489 | { |
||
| 490 | return $this->users; |
||
| 491 | } |
||
| 492 | |||
| 493 | /** |
||
| 494 | * @return Collection|CourseRelUser[] |
||
| 495 | */ |
||
| 496 | public function getTeachers() |
||
| 497 | { |
||
| 498 | $criteria = Criteria::create(); |
||
| 499 | $criteria->where(Criteria::expr()->eq('status', CourseRelUser::TEACHER)); |
||
| 500 | |||
| 501 | return $this->users->matching($criteria); |
||
| 502 | } |
||
| 503 | |||
| 504 | /** |
||
| 505 | * @return Collection|CourseRelUser[] |
||
| 506 | */ |
||
| 507 | public function getStudents() |
||
| 508 | { |
||
| 509 | $criteria = Criteria::create(); |
||
| 510 | $criteria->where(Criteria::expr()->eq('status', CourseRelUser::STUDENT)); |
||
| 511 | |||
| 512 | return $this->users->matching($criteria); |
||
| 513 | } |
||
| 514 | |||
| 515 | public function setUsers(Collection $users): self |
||
| 516 | { |
||
| 517 | $this->users = new ArrayCollection(); |
||
| 518 | |||
| 519 | foreach ($users as $user) { |
||
| 520 | $this->addUsers($user); |
||
| 521 | } |
||
| 522 | |||
| 523 | return $this; |
||
| 524 | } |
||
| 525 | |||
| 526 | public function addUsers(CourseRelUser $courseRelUser): self |
||
| 527 | { |
||
| 528 | $courseRelUser->setCourse($this); |
||
| 529 | |||
| 530 | if (!$this->hasSubscription($courseRelUser)) { |
||
| 531 | $this->users->add($courseRelUser); |
||
| 532 | } |
||
| 533 | |||
| 534 | return $this; |
||
| 535 | } |
||
| 536 | |||
| 537 | public function hasUser(User $user): bool |
||
| 538 | { |
||
| 539 | $criteria = Criteria::create()->where( |
||
| 540 | Criteria::expr()->eq('user', $user) |
||
| 541 | ); |
||
| 542 | |||
| 543 | return $this->getUsers()->matching($criteria)->count() > 0; |
||
| 544 | } |
||
| 545 | |||
| 546 | public function hasStudent(User $user): bool |
||
| 553 | } |
||
| 554 | |||
| 555 | public function hasTeacher(User $user): bool |
||
| 556 | { |
||
| 557 | $criteria = Criteria::create()->where( |
||
| 558 | Criteria::expr()->eq('user', $user) |
||
| 559 | ); |
||
| 560 | |||
| 561 | return $this->getTeachers()->matching($criteria)->count() > 0; |
||
| 562 | } |
||
| 563 | |||
| 564 | public function hasGroup(CGroup $group): void |
||
| 565 | { |
||
| 566 | /*$criteria = Criteria::create()->where( |
||
| 567 | Criteria::expr()->eq('groups', $group) |
||
| 568 | );*/ |
||
| 569 | |||
| 570 | //return $this->getGroups()->contains($group); |
||
| 571 | } |
||
| 572 | |||
| 573 | /** |
||
| 574 | * Remove $user. |
||
| 575 | */ |
||
| 576 | public function removeUsers(CourseRelUser $user): void |
||
| 577 | { |
||
| 578 | foreach ($this->users as $key => $value) { |
||
| 579 | if ($value->getId() === $user->getId()) { |
||
| 580 | unset($this->users[$key]); |
||
| 581 | } |
||
| 582 | } |
||
| 583 | } |
||
| 584 | |||
| 585 | public function addTeacher(User $user): self |
||
| 586 | { |
||
| 587 | $this->addUser($user, 0, 'Trainer', CourseRelUser::TEACHER); |
||
| 588 | |||
| 589 | return $this; |
||
| 590 | } |
||
| 591 | |||
| 592 | public function addStudent(User $user): self |
||
| 593 | { |
||
| 594 | $this->addUser($user, 0, '', CourseRelUser::STUDENT); |
||
| 595 | |||
| 596 | return $this; |
||
| 597 | } |
||
| 598 | |||
| 599 | /** |
||
| 600 | * Get id. |
||
| 601 | * |
||
| 602 | * @return int |
||
| 603 | */ |
||
| 604 | public function getId() |
||
| 605 | { |
||
| 606 | return $this->id; |
||
| 607 | } |
||
| 608 | |||
| 609 | public function setCode(string $code): self |
||
| 610 | { |
||
| 611 | $this->code = $code; |
||
| 612 | $this->visualCode = $code; |
||
| 613 | |||
| 614 | return $this; |
||
| 615 | } |
||
| 616 | |||
| 617 | public function getCode(): string |
||
| 618 | { |
||
| 619 | return $this->code; |
||
| 620 | } |
||
| 621 | |||
| 622 | /** |
||
| 623 | * Get directory, needed in migrations. |
||
| 624 | * |
||
| 625 | * @return string |
||
| 626 | */ |
||
| 627 | public function getDirectory() |
||
| 630 | } |
||
| 631 | |||
| 632 | public function setCourseLanguage(string $courseLanguage): self |
||
| 633 | { |
||
| 634 | $this->courseLanguage = $courseLanguage; |
||
| 635 | |||
| 636 | return $this; |
||
| 637 | } |
||
| 638 | |||
| 639 | public function getCourseLanguage(): string |
||
| 640 | { |
||
| 641 | return $this->courseLanguage; |
||
| 642 | } |
||
| 643 | |||
| 644 | public function setTitle(string $title): self |
||
| 645 | { |
||
| 646 | $this->title = $title; |
||
| 647 | |||
| 648 | // Set the code based in the title if it doesnt exists. |
||
| 649 | if (empty($this->code)) { |
||
| 650 | $this->setCode($title); |
||
| 651 | } |
||
| 652 | |||
| 653 | return $this; |
||
| 654 | } |
||
| 655 | |||
| 656 | public function getTitle(): string |
||
| 657 | { |
||
| 658 | return $this->title; |
||
|
|
|||
| 659 | } |
||
| 660 | |||
| 661 | public function getName(): string |
||
| 662 | { |
||
| 663 | return $this->getTitle(); |
||
| 664 | } |
||
| 665 | |||
| 666 | public function getTitleAndCode(): string |
||
| 667 | { |
||
| 668 | return $this->getTitle().' ('.$this->getCode().')'; |
||
| 669 | } |
||
| 670 | |||
| 671 | public function setDescription(string $description): self |
||
| 676 | } |
||
| 677 | |||
| 678 | public function getDescription(): ?string |
||
| 679 | { |
||
| 680 | return $this->description; |
||
| 681 | } |
||
| 682 | |||
| 683 | public function setCategories(Collection $categories): self |
||
| 684 | { |
||
| 685 | $this->categories = $categories; |
||
| 686 | |||
| 687 | return $this; |
||
| 688 | } |
||
| 689 | |||
| 690 | /** |
||
| 691 | * @return CourseCategory[]|Collection |
||
| 692 | */ |
||
| 693 | public function getCategories() |
||
| 694 | { |
||
| 695 | return $this->categories; |
||
| 696 | } |
||
| 697 | |||
| 698 | public function addCategory(CourseCategory $category): self |
||
| 699 | { |
||
| 700 | $this->categories[] = $category; |
||
| 701 | |||
| 702 | return $this; |
||
| 703 | } |
||
| 704 | |||
| 705 | public function removeCategory(CourseCategory $category): void |
||
| 706 | { |
||
| 707 | $this->categories->removeElement($category); |
||
| 708 | } |
||
| 709 | |||
| 710 | public function setVisibility(int $visibility): self |
||
| 711 | { |
||
| 712 | $this->visibility = $visibility; |
||
| 713 | |||
| 714 | return $this; |
||
| 715 | } |
||
| 716 | |||
| 717 | public function getVisibility(): int |
||
| 718 | { |
||
| 719 | return $this->visibility; |
||
| 720 | } |
||
| 721 | |||
| 722 | public function setShowScore(int $showScore): self |
||
| 723 | { |
||
| 724 | $this->showScore = $showScore; |
||
| 725 | |||
| 726 | return $this; |
||
| 727 | } |
||
| 728 | |||
| 729 | /** |
||
| 730 | * Get showScore. |
||
| 731 | * |
||
| 732 | * @return int |
||
| 733 | */ |
||
| 734 | public function getShowScore() |
||
| 735 | { |
||
| 736 | return $this->showScore; |
||
| 737 | } |
||
| 738 | |||
| 739 | public function setTutorName(?string $tutorName): self |
||
| 740 | { |
||
| 741 | $this->tutorName = $tutorName; |
||
| 742 | |||
| 743 | return $this; |
||
| 744 | } |
||
| 745 | |||
| 746 | public function getTutorName(): ?string |
||
| 747 | { |
||
| 748 | return $this->tutorName; |
||
| 749 | } |
||
| 750 | |||
| 751 | public function setVisualCode(string $visualCode): self |
||
| 752 | { |
||
| 753 | $this->visualCode = $visualCode; |
||
| 754 | |||
| 755 | return $this; |
||
| 756 | } |
||
| 757 | |||
| 758 | /** |
||
| 759 | * Get visualCode. |
||
| 760 | * |
||
| 761 | * @return string |
||
| 762 | */ |
||
| 763 | public function getVisualCode() |
||
| 764 | { |
||
| 765 | return $this->visualCode; |
||
| 766 | } |
||
| 767 | |||
| 768 | public function setDepartmentName(string $departmentName): self |
||
| 769 | { |
||
| 770 | $this->departmentName = $departmentName; |
||
| 771 | |||
| 772 | return $this; |
||
| 773 | } |
||
| 774 | |||
| 775 | /** |
||
| 776 | * Get departmentName. |
||
| 777 | * |
||
| 778 | * @return string |
||
| 779 | */ |
||
| 780 | public function getDepartmentName() |
||
| 781 | { |
||
| 782 | return $this->departmentName; |
||
| 783 | } |
||
| 784 | |||
| 785 | public function setDepartmentUrl(string $departmentUrl): self |
||
| 786 | { |
||
| 787 | $this->departmentUrl = $departmentUrl; |
||
| 788 | |||
| 789 | return $this; |
||
| 790 | } |
||
| 791 | |||
| 792 | /** |
||
| 793 | * Get departmentUrl. |
||
| 794 | * |
||
| 795 | * @return string |
||
| 796 | */ |
||
| 797 | public function getDepartmentUrl() |
||
| 798 | { |
||
| 799 | return $this->departmentUrl; |
||
| 800 | } |
||
| 801 | |||
| 802 | public function setDiskQuota(int $diskQuota): self |
||
| 803 | { |
||
| 804 | $this->diskQuota = $diskQuota; |
||
| 805 | |||
| 806 | return $this; |
||
| 807 | } |
||
| 808 | |||
| 809 | /** |
||
| 810 | * Get diskQuota. |
||
| 811 | * |
||
| 812 | * @return int |
||
| 813 | */ |
||
| 814 | public function getDiskQuota() |
||
| 815 | { |
||
| 816 | return $this->diskQuota; |
||
| 817 | } |
||
| 818 | |||
| 819 | public function setLastVisit(DateTime $lastVisit): self |
||
| 820 | { |
||
| 821 | $this->lastVisit = $lastVisit; |
||
| 822 | |||
| 823 | return $this; |
||
| 824 | } |
||
| 825 | |||
| 826 | /** |
||
| 827 | * Get lastVisit. |
||
| 828 | * |
||
| 829 | * @return DateTime |
||
| 830 | */ |
||
| 831 | public function getLastVisit() |
||
| 832 | { |
||
| 833 | return $this->lastVisit; |
||
| 834 | } |
||
| 835 | |||
| 836 | public function setLastEdit(DateTime $lastEdit): self |
||
| 837 | { |
||
| 838 | $this->lastEdit = $lastEdit; |
||
| 839 | |||
| 840 | return $this; |
||
| 841 | } |
||
| 842 | |||
| 843 | /** |
||
| 844 | * Get lastEdit. |
||
| 845 | * |
||
| 846 | * @return DateTime |
||
| 847 | */ |
||
| 848 | public function getLastEdit() |
||
| 849 | { |
||
| 850 | return $this->lastEdit; |
||
| 851 | } |
||
| 852 | |||
| 853 | public function setCreationDate(DateTime $creationDate): self |
||
| 854 | { |
||
| 855 | $this->creationDate = $creationDate; |
||
| 856 | |||
| 857 | return $this; |
||
| 858 | } |
||
| 859 | |||
| 860 | /** |
||
| 861 | * Get creationDate. |
||
| 862 | * |
||
| 863 | * @return DateTime |
||
| 864 | */ |
||
| 865 | public function getCreationDate() |
||
| 866 | { |
||
| 867 | return $this->creationDate; |
||
| 868 | } |
||
| 869 | |||
| 870 | public function setExpirationDate(DateTime $expirationDate): self |
||
| 871 | { |
||
| 872 | $this->expirationDate = $expirationDate; |
||
| 873 | |||
| 874 | return $this; |
||
| 875 | } |
||
| 876 | |||
| 877 | /** |
||
| 878 | * Get expirationDate. |
||
| 879 | * |
||
| 880 | * @return DateTime |
||
| 881 | */ |
||
| 882 | public function getExpirationDate() |
||
| 883 | { |
||
| 884 | return $this->expirationDate; |
||
| 885 | } |
||
| 886 | |||
| 887 | public function setSubscribe(bool $subscribe): self |
||
| 888 | { |
||
| 889 | $this->subscribe = $subscribe; |
||
| 890 | |||
| 891 | return $this; |
||
| 892 | } |
||
| 893 | |||
| 894 | /** |
||
| 895 | * Get subscribe. |
||
| 896 | * |
||
| 897 | * @return bool |
||
| 898 | */ |
||
| 899 | public function getSubscribe() |
||
| 900 | { |
||
| 901 | return $this->subscribe; |
||
| 902 | } |
||
| 903 | |||
| 904 | public function setUnsubscribe(bool $unsubscribe): self |
||
| 905 | { |
||
| 906 | $this->unsubscribe = $unsubscribe; |
||
| 907 | |||
| 908 | return $this; |
||
| 909 | } |
||
| 910 | |||
| 911 | /** |
||
| 912 | * Get unsubscribe. |
||
| 913 | * |
||
| 914 | * @return bool |
||
| 915 | */ |
||
| 916 | public function getUnsubscribe() |
||
| 917 | { |
||
| 918 | return $this->unsubscribe; |
||
| 919 | } |
||
| 920 | |||
| 921 | public function setRegistrationCode(string $registrationCode): self |
||
| 922 | { |
||
| 923 | $this->registrationCode = $registrationCode; |
||
| 924 | |||
| 925 | return $this; |
||
| 926 | } |
||
| 927 | |||
| 928 | /** |
||
| 929 | * Get registrationCode. |
||
| 930 | * |
||
| 931 | * @return string |
||
| 932 | */ |
||
| 933 | public function getRegistrationCode() |
||
| 934 | { |
||
| 935 | return $this->registrationCode; |
||
| 936 | } |
||
| 937 | |||
| 938 | public function setLegal(string $legal): self |
||
| 939 | { |
||
| 940 | $this->legal = $legal; |
||
| 941 | |||
| 942 | return $this; |
||
| 943 | } |
||
| 944 | |||
| 945 | /** |
||
| 946 | * Get legal. |
||
| 947 | * |
||
| 948 | * @return string |
||
| 949 | */ |
||
| 950 | public function getLegal() |
||
| 951 | { |
||
| 952 | return $this->legal; |
||
| 953 | } |
||
| 954 | |||
| 955 | public function setActivateLegal(int $activateLegal): self |
||
| 956 | { |
||
| 957 | $this->activateLegal = $activateLegal; |
||
| 958 | |||
| 959 | return $this; |
||
| 960 | } |
||
| 961 | |||
| 962 | /** |
||
| 963 | * Get activateLegal. |
||
| 964 | * |
||
| 965 | * @return int |
||
| 966 | */ |
||
| 967 | public function getActivateLegal() |
||
| 968 | { |
||
| 969 | return $this->activateLegal; |
||
| 970 | } |
||
| 971 | |||
| 972 | /** |
||
| 973 | * @return bool |
||
| 974 | */ |
||
| 975 | public function isAddTeachersToSessionsCourses() |
||
| 976 | { |
||
| 977 | return $this->addTeachersToSessionsCourses; |
||
| 978 | } |
||
| 979 | |||
| 980 | public function setAddTeachersToSessionsCourses(bool $addTeachersToSessionsCourses): self |
||
| 981 | { |
||
| 982 | $this->addTeachersToSessionsCourses = $addTeachersToSessionsCourses; |
||
| 983 | |||
| 984 | return $this; |
||
| 985 | } |
||
| 986 | |||
| 987 | public function setCourseTypeId(int $courseTypeId): self |
||
| 988 | { |
||
| 989 | $this->courseTypeId = $courseTypeId; |
||
| 990 | |||
| 991 | return $this; |
||
| 992 | } |
||
| 993 | |||
| 994 | /** |
||
| 995 | * Get courseTypeId. |
||
| 996 | * |
||
| 997 | * @return int |
||
| 998 | */ |
||
| 999 | public function getCourseTypeId() |
||
| 1000 | { |
||
| 1001 | return $this->courseTypeId; |
||
| 1002 | } |
||
| 1003 | |||
| 1004 | public function getRoom(): ?Room |
||
| 1005 | { |
||
| 1006 | return $this->room; |
||
| 1007 | } |
||
| 1008 | |||
| 1009 | public function setRoom(Room $room): self |
||
| 1010 | { |
||
| 1011 | $this->room = $room; |
||
| 1012 | |||
| 1013 | return $this; |
||
| 1014 | } |
||
| 1015 | |||
| 1016 | public function isActive(): bool |
||
| 1017 | { |
||
| 1018 | $activeVisibilityList = [ |
||
| 1019 | self::REGISTERED, |
||
| 1020 | self::OPEN_PLATFORM, |
||
| 1021 | self::OPEN_WORLD, |
||
| 1022 | ]; |
||
| 1023 | |||
| 1024 | return \in_array($this->visibility, $activeVisibilityList, true); |
||
| 1025 | } |
||
| 1026 | |||
| 1027 | /** |
||
| 1028 | * Anybody can see this course. |
||
| 1029 | */ |
||
| 1030 | public function isPublic(): bool |
||
| 1031 | { |
||
| 1032 | return self::OPEN_WORLD === $this->visibility; |
||
| 1033 | } |
||
| 1034 | |||
| 1035 | public function isHidden(): bool |
||
| 1036 | { |
||
| 1037 | return self::HIDDEN === $this->visibility; |
||
| 1038 | } |
||
| 1039 | |||
| 1040 | public static function getStatusList(): array |
||
| 1041 | { |
||
| 1042 | return [ |
||
| 1043 | self::CLOSED => 'Closed', |
||
| 1044 | self::REGISTERED => 'Registered', |
||
| 1045 | self::OPEN_PLATFORM => 'Open platform', |
||
| 1046 | self::OPEN_WORLD => 'Open world', |
||
| 1047 | self::HIDDEN => 'Hidden', |
||
| 1048 | ]; |
||
| 1049 | } |
||
| 1050 | |||
| 1051 | /** |
||
| 1052 | * @return Session |
||
| 1053 | */ |
||
| 1054 | public function getCurrentSession() |
||
| 1055 | { |
||
| 1056 | return $this->currentSession; |
||
| 1057 | } |
||
| 1058 | |||
| 1059 | public function setCurrentSession(Session $session): self |
||
| 1060 | { |
||
| 1061 | // If the session is registered in the course session list. |
||
| 1062 | /*if ($this->getSessions()->contains($session->getId())) { |
||
| 1063 | $this->currentSession = $session; |
||
| 1064 | }*/ |
||
| 1065 | |||
| 1066 | $list = $this->getSessions(); |
||
| 1067 | /** @var SessionRelCourse $item */ |
||
| 1068 | foreach ($list as $item) { |
||
| 1069 | if ($item->getSession()->getId() === $session->getId()) { |
||
| 1070 | $this->currentSession = $session; |
||
| 1071 | |||
| 1072 | break; |
||
| 1073 | } |
||
| 1074 | } |
||
| 1075 | |||
| 1076 | return $this; |
||
| 1077 | } |
||
| 1078 | |||
| 1079 | public function setCurrentUrl(AccessUrl $url): self |
||
| 1080 | { |
||
| 1081 | $urlList = $this->getUrls(); |
||
| 1082 | /** @var AccessUrlRelCourse $item */ |
||
| 1083 | foreach ($urlList as $item) { |
||
| 1084 | if ($item->getUrl()->getId() === $url->getId()) { |
||
| 1085 | $this->currentUrl = $url; |
||
| 1086 | |||
| 1087 | break; |
||
| 1088 | } |
||
| 1089 | } |
||
| 1090 | |||
| 1091 | return $this; |
||
| 1092 | } |
||
| 1093 | |||
| 1094 | /** |
||
| 1095 | * @return AccessUrl |
||
| 1096 | */ |
||
| 1097 | public function getCurrentUrl() |
||
| 1098 | { |
||
| 1099 | return $this->currentUrl; |
||
| 1100 | } |
||
| 1101 | |||
| 1102 | /** |
||
| 1103 | * Get issuedSkills. |
||
| 1104 | * |
||
| 1105 | * @return Collection |
||
| 1106 | */ |
||
| 1107 | public function getIssuedSkills() |
||
| 1108 | { |
||
| 1109 | return $this->issuedSkills; |
||
| 1110 | } |
||
| 1111 | |||
| 1112 | public function hasSubscription(CourseRelUser $subscription): bool |
||
| 1113 | { |
||
| 1114 | if (0 !== $this->getUsers()->count()) { |
||
| 1115 | $criteria = Criteria::create()->where( |
||
| 1116 | Criteria::expr()->eq('user', $subscription->getUser()) |
||
| 1117 | )->andWhere( |
||
| 1118 | Criteria::expr()->eq('status', $subscription->getStatus()) |
||
| 1119 | )->andWhere( |
||
| 1120 | Criteria::expr()->eq('relationType', $subscription->getRelationType()) |
||
| 1121 | ); |
||
| 1122 | |||
| 1123 | $relation = $this->getUsers()->matching($criteria); |
||
| 1124 | |||
| 1125 | return $relation->count() > 0; |
||
| 1126 | } |
||
| 1127 | |||
| 1128 | return false; |
||
| 1129 | } |
||
| 1130 | |||
| 1131 | public function addUser(User $user, int $relationType, ?string $role, int $status): self |
||
| 1132 | { |
||
| 1133 | $courseRelUser = |
||
| 1134 | (new CourseRelUser()) |
||
| 1135 | ->setCourse($this) |
||
| 1136 | ->setUser($user) |
||
| 1137 | ->setRelationType($relationType) |
||
| 1138 | ->setStatus($status) |
||
| 1139 | ; |
||
| 1140 | $this->addUsers($courseRelUser); |
||
| 1141 | |||
| 1142 | return $this; |
||
| 1143 | } |
||
| 1144 | |||
| 1145 | /** |
||
| 1146 | * @return SessionRelCourseRelUser[]|Collection |
||
| 1147 | */ |
||
| 1148 | public function getSessionRelCourseRelUsers() |
||
| 1149 | { |
||
| 1150 | return $this->sessionRelCourseRelUsers; |
||
| 1151 | } |
||
| 1152 | |||
| 1153 | public function setSessionRelCourseRelUsers(Collection $sessionUserSubscriptions): self |
||
| 1154 | { |
||
| 1155 | $this->sessionRelCourseRelUsers = $sessionUserSubscriptions; |
||
| 1156 | |||
| 1157 | return $this; |
||
| 1158 | } |
||
| 1159 | |||
| 1160 | /** |
||
| 1161 | * @return SkillRelCourse[]|Collection |
||
| 1162 | */ |
||
| 1163 | public function getSkills() |
||
| 1164 | { |
||
| 1165 | return $this->skills; |
||
| 1166 | } |
||
| 1167 | |||
| 1168 | /** |
||
| 1169 | * @param SkillRelCourse[]|Collection $skills |
||
| 1170 | */ |
||
| 1171 | public function setSkills(Collection $skills): self |
||
| 1172 | { |
||
| 1173 | $this->skills = $skills; |
||
| 1174 | |||
| 1175 | return $this; |
||
| 1176 | } |
||
| 1177 | |||
| 1178 | /** |
||
| 1179 | * @return GradebookCategory[]|Collection |
||
| 1180 | */ |
||
| 1181 | public function getGradebookCategories() |
||
| 1182 | { |
||
| 1183 | return $this->gradebookCategories; |
||
| 1184 | } |
||
| 1185 | |||
| 1186 | /** |
||
| 1187 | * @param GradebookCategory[]|Collection $gradebookCategories |
||
| 1188 | */ |
||
| 1189 | public function setGradebookCategories(Collection $gradebookCategories): self |
||
| 1190 | { |
||
| 1191 | $this->gradebookCategories = $gradebookCategories; |
||
| 1192 | |||
| 1193 | return $this; |
||
| 1194 | } |
||
| 1195 | |||
| 1196 | /** |
||
| 1197 | * @return GradebookEvaluation[]|Collection |
||
| 1198 | */ |
||
| 1199 | public function getGradebookEvaluations() |
||
| 1200 | { |
||
| 1201 | return $this->gradebookEvaluations; |
||
| 1202 | } |
||
| 1203 | |||
| 1204 | /** |
||
| 1205 | * @param GradebookEvaluation[]|Collection $gradebookEvaluations |
||
| 1206 | */ |
||
| 1207 | public function setGradebookEvaluations(Collection $gradebookEvaluations): self |
||
| 1208 | { |
||
| 1209 | $this->gradebookEvaluations = $gradebookEvaluations; |
||
| 1210 | |||
| 1211 | return $this; |
||
| 1212 | } |
||
| 1213 | |||
| 1214 | /** |
||
| 1215 | * @return GradebookLink[]|Collection |
||
| 1216 | */ |
||
| 1217 | public function getGradebookLinks() |
||
| 1218 | { |
||
| 1219 | return $this->gradebookLinks; |
||
| 1220 | } |
||
| 1221 | |||
| 1222 | /** |
||
| 1223 | * @param GradebookLink[]|Collection $gradebookLinks |
||
| 1224 | */ |
||
| 1225 | public function setGradebookLinks(Collection $gradebookLinks): self |
||
| 1226 | { |
||
| 1227 | $this->gradebookLinks = $gradebookLinks; |
||
| 1228 | |||
| 1229 | return $this; |
||
| 1230 | } |
||
| 1231 | |||
| 1232 | /** |
||
| 1233 | * @return TrackEHotspot[]|Collection |
||
| 1234 | */ |
||
| 1235 | public function getTrackEHotspots() |
||
| 1236 | { |
||
| 1237 | return $this->trackEHotspots; |
||
| 1238 | } |
||
| 1239 | |||
| 1240 | /** |
||
| 1241 | * @param TrackEHotspot[]|Collection $trackEHotspots |
||
| 1242 | */ |
||
| 1243 | public function setTrackEHotspots(Collection $trackEHotspots): self |
||
| 1244 | { |
||
| 1245 | $this->trackEHotspots = $trackEHotspots; |
||
| 1246 | |||
| 1247 | return $this; |
||
| 1248 | } |
||
| 1249 | |||
| 1250 | /** |
||
| 1251 | * @return SearchEngineRef[]|Collection |
||
| 1252 | */ |
||
| 1253 | public function getSearchEngineRefs() |
||
| 1254 | { |
||
| 1255 | return $this->searchEngineRefs; |
||
| 1256 | } |
||
| 1257 | |||
| 1258 | /** |
||
| 1259 | * @param SearchEngineRef[]|Collection $searchEngineRefs |
||
| 1260 | */ |
||
| 1261 | public function setSearchEngineRefs(Collection $searchEngineRefs): self |
||
| 1266 | } |
||
| 1267 | |||
| 1268 | public function getIntroduction(): ?string |
||
| 1269 | { |
||
| 1270 | return $this->introduction; |
||
| 1271 | } |
||
| 1272 | |||
| 1273 | public function setIntroduction(?string $introduction): self |
||
| 1274 | { |
||
| 1275 | $this->introduction = $introduction; |
||
| 1276 | |||
| 1277 | return $this; |
||
| 1278 | } |
||
| 1279 | |||
| 1280 | /** |
||
| 1281 | * @return Templates[]|Collection |
||
| 1282 | */ |
||
| 1283 | public function getTemplates() |
||
| 1284 | { |
||
| 1285 | return $this->templates; |
||
| 1286 | } |
||
| 1287 | |||
| 1288 | /** |
||
| 1289 | * @param Templates[]|Collection $templates |
||
| 1290 | */ |
||
| 1291 | public function setTemplates(Collection $templates): self |
||
| 1292 | { |
||
| 1293 | $this->templates = $templates; |
||
| 1294 | |||
| 1295 | return $this; |
||
| 1296 | } |
||
| 1297 | |||
| 1298 | public function getDefaultIllustration(int $size): string |
||
| 1301 | } |
||
| 1302 | |||
| 1303 | public function getResourceIdentifier(): int |
||
| 1304 | { |
||
| 1305 | return $this->getId(); |
||
| 1306 | } |
||
| 1307 | |||
| 1308 | public function getResourceName(): string |
||
| 1311 | } |
||
| 1312 | |||
| 1313 | public function setResourceName(string $name): self |
||
| 1314 | { |
||
| 1315 | return $this->setCode($name); |
||
| 1316 | } |
||
| 1317 | } |
||
| 1318 |