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

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. #[ORM\UniqueConstraint(
  16.     fields: ['lockBy''targetChannel'],
  17. )]
  18. class SharedModule extends Module implements LockByInterface
  19. {
  20.     use SharedScholarTrait;
  21.     #[ORM\ManyToOne(targetEntityOriginModule::class, fetch'EAGER'inversedBy'sharedModules')]
  22.     #[ORM\JoinColumn(nullablefalseonDelete'CASCADE')]
  23.     private ?OriginModule $lockBy null;
  24.     #[ORM\Column(type'integer'nullabletrue)]
  25.     private ?int $lockByStatus null;
  26.     public function getLockBy(): ?OriginModule
  27.     {
  28.         return $this->lockBy;
  29.     }
  30.     public function setLockBy(?OriginModule $lockBy): static
  31.     {
  32.         $this->lockBy $lockBy;
  33.         return $this;
  34.     }
  35.     public function getImage(): ?Image
  36.     {
  37.         return $this->getLockBy()?->getImage();
  38.     }
  39.     public function getLockByStatus(): ?bool
  40.     {
  41.         return $this->lockByStatus;
  42.     }
  43.     public function setLockByStatus(?bool $status): static
  44.     {
  45.         $this->lockByStatus $status;
  46.         return $this;
  47.     }
  48.     public function getLockByOwnerChannel(): ?ChannelInterface
  49.     {
  50.         return $this->getLockBy()?->getOwnerChannel();
  51.     }
  52. }