src/Entity/JournalFooterTranslation.php line 26

  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM,
  4.     Doctrine\DBAL\Types\Types;
  5. use Symfony\Component\Serializer\Annotation\Groups;
  6. use ApiPlatform\Metadata\ApiResource,
  7.     ApiPlatform\Metadata\ApiProperty,
  8.     ApiPlatform\Metadata\Get;
  9. use App\Entity\Trait\IdTrait,
  10.     App\Entity\Trait\UuidTrait,
  11.     App\Entity\Trait\TimestampableTrait,
  12.     App\Entity\Trait\TranslationTrait,
  13.     App\Entity\Interface\TranslationInterface,
  14.     App\Enum\Language;
  15. #[ApiResource(
  16.     security'is_granted("' JournalFooter::class . '")',
  17.     operations: [ new Get() ],
  18.     extraProperties: ['standard_put' => false],
  19. )]
  20. #[ORM\Entity]
  21. class JournalFooterTranslation implements TranslationInterface
  22. {
  23.     use IdTrait,
  24.         UuidTrait,
  25.         TimestampableTrait,
  26.         TranslationTrait;
  27.     #[ApiProperty(description'Title')]
  28.     #[Groups(['read''write'])]
  29.     #[ORM\Column(typeTypes::STRINGlength511nullabletrue)]
  30.     private ?string $title null;
  31.     #[ApiProperty(description'Link')]
  32.     #[Groups(['read:' self::class, 'write'])]
  33.     #[ORM\Column(typeTypes::STRINGlength1023nullabletrue)]
  34.     private ?string $link null;
  35.     #[ApiProperty(description'Page'writableLinkfalse)]
  36.     #[Groups(['read:' self::class, 'write'])]
  37.     #[ORM\ManyToOne(targetEntityPage::class)]
  38.     #[ORM\JoinColumn(onDelete'set null')]
  39.     private ?Page $page null;
  40.     #[ApiProperty(description'Journal page'writableLinkfalse)]
  41.     #[Groups(['read:' self::class, 'write'])]
  42.     #[ORM\ManyToOne(targetEntityJournalPage::class)]
  43.     #[ORM\JoinColumn(onDelete'set null')]
  44.     private ?JournalPage $journalPage null;
  45.     public function __construct(JournalFooter $parentLanguage $lang)
  46.     {
  47.         $this->setUuid();
  48.         $this->parent $parent;
  49.         $this->lang $lang;
  50.         $this->createdAt = new \DateTimeImmutable();
  51.         $this->updatedAt = new \DateTimeImmutable();
  52.         $parent->addTranslation($this);
  53.     }
  54.     public function getTitle(): ?string
  55.     {
  56.         return $this->title;
  57.     }
  58.     public function setTitle(?string $title): self
  59.     {
  60.         $this->title $title;
  61.         return $this;
  62.     }
  63.     public function getLink(): ?string
  64.     {
  65.         return $this->link;
  66.     }
  67.     public function setLink(?string $link): self
  68.     {
  69.         $this->link $link;
  70.         return $this;
  71.     }
  72.     public function getPage(): ?Page
  73.     {
  74.         return $this->page;
  75.     }
  76.     public function setPage(?Page $page): self
  77.     {
  78.         $this->page $page;
  79.         return $this;
  80.     }
  81.     public function getJournalPage(): ?JournalPage
  82.     {
  83.         return $this->journalPage;
  84.     }
  85.     public function setJournalPage(?JournalPage $journalPage): self
  86.     {
  87.         $this->journalPage $journalPage;
  88.         return $this;
  89.     }
  90.     public function getIsLinkable(): bool
  91.     {
  92.         if (!empty($this->getLink()) || $this->getPage() || $this->getJournalPage()) {
  93.             return true;
  94.         }
  95.         return false;
  96.     }
  97. }