src/Entity/Scholar/Module/SharedModule.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Scholar\Module;
  3. use App\Entity\Channel\Image;
  4. use App\Entity\Channel\LockByInterface;
  5. use App\Entity\Scholar\SharedScholarTrait;
  6. use App\Repository\Scholar\SharedModuleRepository;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Nellapp\Bundle\SDKBundle\Channel\Entity\ChannelInterface;
  9. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  10. #[ORM\Table(name'scholar_shared_modules')]
  11. #[ORM\Entity(repositoryClassSharedModuleRepository::class)]
  12. #[UniqueEntity(
  13.     fields: ['lockBy''ownerChannel'],
  14. )]
  15. class SharedModule extends Module implements LockByInterface
  16. {
  17.     use SharedScholarTrait;
  18.     #[ORM\ManyToOne(targetEntityOriginModule::class, fetch'EAGER'inversedBy'sharedModules')]
  19.     #[ORM\JoinColumn(nullablefalseonDelete'CASCADE')]
  20.     private ?OriginModule $lockBy null;
  21.     #[ORM\Column(type'integer'nullabletrue)]
  22.     private ?int $lockByStatus null;
  23.     public function getLockBy(): ?OriginModule
  24.     {
  25.         return $this->lockBy;
  26.     }
  27.     public function setLockBy(?OriginModule $lockBy): static
  28.     {
  29.         $this->lockBy $lockBy;
  30.         return $this;
  31.     }
  32.     public function getImage(): ?Image
  33.     {
  34.         return $this->getLockBy()?->getImage();
  35.     }
  36.     public function getLockByStatus(): ?bool
  37.     {
  38.         return $this->lockByStatus;
  39.     }
  40.     public function setLockByStatus(?bool $status): static
  41.     {
  42.         $this->lockByStatus $status;
  43.         return $this;
  44.     }
  45.     public function getLockByOwnerChannel(): ?ChannelInterface
  46.     {
  47.         return $this->getLockBy()?->getOwnerChannel();
  48.     }
  49. }