src/Entity/Scholar/Chapter/SharedChapter.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Scholar\Chapter;
  3. use App\Entity\Channel\LockByInterface;
  4. use App\Repository\Scholar\SharedChapterRepository;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Nellapp\Bundle\SDKBundle\Channel\Entity\ChannelInterface;
  7. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  8. #[ORM\Table(name'scholar_shared_chapters')]
  9. #[ORM\Entity(repositoryClassSharedChapterRepository::class)]
  10. #[UniqueEntity(
  11.     fields: ['lockBy''lesson'],
  12. )]
  13. class SharedChapter extends Chapter implements LockByInterface
  14. {
  15.     #[ORM\ManyToOne(targetEntityOriginChapter::class, fetch'EAGER'inversedBy'sharedChapters')]
  16.     #[ORM\JoinColumn(nullablefalseonDelete'CASCADE')]
  17.     private ?OriginChapter $lockBy null;
  18.     public function getName(): ?string
  19.     {
  20.         return $this->lockBy?->getName();
  21.     }
  22.     public function getBody(): ?string
  23.     {
  24.         return $this->lockBy?->getBody();
  25.     }
  26.     public function getDescription(): ?string
  27.     {
  28.         return $this->lockBy?->getDescription();
  29.     }
  30.     public function getOrder(): ?int
  31.     {
  32.         return $this->lockBy?->getOrder();
  33.     }
  34.     public function getLockBy(): ?Chapter
  35.     {
  36.         return $this->lockBy;
  37.     }
  38.     public function setLockBy(?Chapter $lockBy): Chapter
  39.     {
  40.         $this->lockBy $lockBy;
  41.         return $this;
  42.     }
  43.     public function getLockByOwnerChannel(): ?ChannelInterface
  44.     {
  45.         return $this->getLockBy()?->getLesson()->getOwnerChannel();
  46.     }
  47.     public function getLockByStatus(): ?bool
  48.     {
  49.         return null;
  50.     }
  51.     public function setLockByStatus(?bool $status): static
  52.     {
  53.         return $this;
  54.     }
  55.     public function getOwnerChannel(): ?ChannelInterface
  56.     {
  57.         return $this->getLesson()->getOwnerChannel();
  58.     }
  59. }