src/Entity/Scholar/Lesson/OriginLesson.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Scholar\Lesson;
  3. use App\Entity\Channel\Image;
  4. use App\Entity\Scholar\Indexed\IndexedContent;
  5. use App\Entity\Scholar\OriginScholarInterface;
  6. use App\Entity\Scholar\OriginScholarPropertyTrait;
  7. use App\Repository\Scholar\OriginLessonRepository;
  8. use Doctrine\Common\Collections\Collection;
  9. use Doctrine\ORM\Mapping as ORM;
  10. use Symfony\Component\Serializer\Annotation as Serial;
  11. use Symfony\Component\Validator\Constraints as Assert;
  12. #[ORM\Table(name'scholar_origin_lessons')]
  13. #[ORM\Entity(repositoryClassOriginLessonRepository::class)]
  14. class OriginLesson extends Lesson implements OriginScholarInterface
  15. {
  16.     use OriginScholarPropertyTrait;
  17.     #[ORM\Column(type'string'length255nullabletrue)]
  18.     #[
  19.         Assert\Length(
  20.             min2,
  21.             max255,
  22.             minMessage'scholar.ref.name.Length.min',
  23.             maxMessage'scholar.ref.name.Length.max'
  24.         )
  25.     ]
  26.     private ?string $ref null;
  27.     #[ORM\ManyToOne(targetEntityImage::class)]
  28.     #[ORM\JoinColumn(nullabletrueonDelete'SET NULL')]
  29.     #[Serial\Groups(['partner_api_lessons_show'])]
  30.     private ?Image $image null;
  31.     #[ORM\Column(type'text'nullabletrue)]
  32.     private ?string $objective null;
  33.     #[ORM\OneToMany(mappedBy'lockBy'targetEntitySharedLesson::class, cascade: ['remove'], fetch'EXTRA_LAZY'orphanRemovaltrue)]
  34.     private ?Collection $sharedLessons;
  35.     #[ORM\Column(type'boolean'nullablefalseoptions: ['default' => true])]
  36.     private bool $lessonReviewActivated true;
  37.     #[ORM\OneToOne(targetEntityIndexedContent::class, cascade: ['remove''persist'], orphanRemovaltrue)]
  38.     private ?IndexedContent $indexedContent null;
  39.     public function isIndexed(): bool
  40.     {
  41.         return $this->getIndexedContent() !== null;
  42.     }
  43.     public function getIndexedContent(): ?IndexedContent
  44.     {
  45.         return $this->indexedContent;
  46.     }
  47.     public function setRef(?string $ref): Lesson
  48.     {
  49.         $this->ref $ref;
  50.         return $this;
  51.     }
  52.     public function setImage(?Image $image): static
  53.     {
  54.         $this->image $image;
  55.         return $this;
  56.     }
  57.     public function setObjective(?string $objective): self
  58.     {
  59.         $this->objective $objective;
  60.         return $this;
  61.     }
  62.     public function hasCaseStudy(): bool
  63.     {
  64.         return $this->getActivePracticalCase() !== null;
  65.     }
  66.     public function getRef(): ?string
  67.     {
  68.         return $this->ref;
  69.     }
  70.     public function getImage(): ?Image
  71.     {
  72.         return $this->image;
  73.     }
  74.     public function getObjective(): ?string
  75.     {
  76.         return $this->objective;
  77.     }
  78.     public function getSharedLessons(): ?Collection
  79.     {
  80.         return $this->sharedLessons;
  81.     }
  82.     public function setSharedLessons(?Collection $sharedLessons): OriginLesson
  83.     {
  84.         $this->sharedLessons $sharedLessons;
  85.         return $this;
  86.     }
  87.     public function setIndexedContent(?IndexedContent $indexedContent): OriginLesson
  88.     {
  89.         $this->indexedContent $indexedContent;
  90.         return $this;
  91.     }
  92. }