src/Entity/Scholar/PracticalCase/SharedPracticalCase.php line 19

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Scholar\PracticalCase;
  3. use App\Entity\Channel\LockByInterface;
  4. use App\Repository\Scholar\SharedPracticalCaseRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Nellapp\Bundle\SDKBundle\Channel\Entity\ChannelInterface;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  10. #[ORM\Table(name'scholar_shared_practical_cases')]
  11. #[ORM\Entity(repositoryClassSharedPracticalCaseRepository::class)]
  12. #[UniqueEntity(
  13.     fields: ['lockBy''lesson'],
  14. )]
  15. class SharedPracticalCase extends PracticalCase implements LockByInterface
  16. {
  17.     #[ORM\ManyToOne(targetEntityOriginPracticalCase::class, fetch'EAGER'inversedBy'sharedPracticalCases')]
  18.     #[ORM\JoinColumn(nullablefalseonDelete'CASCADE')]
  19.     private ?OriginPracticalCase $lockBy null;
  20.     public function getTitle(): ?string
  21.     {
  22.         return $this->lockBy?->getTitle();
  23.     }
  24.     public function getContent(): ?string
  25.     {
  26.         return $this->lockBy?->getContent();
  27.     }
  28.     public function getRemark(): ?string
  29.     {
  30.         return $this->lockBy?->getRemark();
  31.     }
  32.     public function getEstimateTime(): ?int
  33.     {
  34.         return $this->lockBy?->getEstimateTime();
  35.     }
  36.     public function getCorrection(): ?string
  37.     {
  38.         return $this->lockBy?->getCorrection();
  39.     }
  40.     public function getIsArchived(): ?bool
  41.     {
  42.         return $this->lockBy?->getIsArchived();
  43.     }
  44.     public function getPracticalCaseResources(): Collection
  45.     {
  46.         return $this->lockBy?->getPracticalCaseResources() ?? new ArrayCollection();
  47.     }
  48.     public function getLockBy(): ?PracticalCase
  49.     {
  50.         return $this->lockBy;
  51.     }
  52.     public function setLockBy(?PracticalCase $lockBy): PracticalCase
  53.     {
  54.         $this->lockBy $lockBy;
  55.         return $this;
  56.     }
  57.     public function getLockByOwnerChannel(): ?ChannelInterface
  58.     {
  59.         return $this->getLockBy()?->getLesson()->getOwnerChannel();
  60.     }
  61.     public function getLockByStatus(): ?bool
  62.     {
  63.         return null;
  64.     }
  65.     public function setLockByStatus(?bool $status): static
  66.     {
  67.         return $this;
  68.     }
  69. }