src/Entity/JournalGlobalFooterTranslation.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("' JournalGlobalFooter::class . '")',
  17.     operations: [ new Get() ],
  18.     extraProperties: ['standard_put' => false],
  19. )]
  20. #[ORM\Entity]
  21. class JournalGlobalFooterTranslation 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.     public function __construct(JournalGlobalFooter $parentLanguage $lang)
  41.     {
  42.         $this->setUuid();
  43.         $this->parent $parent;
  44.         $this->lang $lang;
  45.         $this->createdAt = new \DateTimeImmutable();
  46.         $this->updatedAt = new \DateTimeImmutable();
  47.         $parent->addTranslation($this);
  48.     }
  49.     public function getTitle(): ?string
  50.     {
  51.         return $this->title;
  52.     }
  53.     public function setTitle(?string $title): self
  54.     {
  55.         $this->title $title;
  56.         return $this;
  57.     }
  58.     public function getLink(): ?string
  59.     {
  60.         return $this->link;
  61.     }
  62.     public function setLink(?string $link): self
  63.     {
  64.         $this->link $link;
  65.         return $this;
  66.     }
  67.     public function getPage(): ?Page
  68.     {
  69.         return $this->page;
  70.     }
  71.     public function setPage(?Page $page): self
  72.     {
  73.         $this->page $page;
  74.         return $this;
  75.     }
  76.     public function getIsLinkable(): bool
  77.     {
  78.         if (!empty($this->getLink()) || $this->getPage()) {
  79.             return true;
  80.         }
  81.         return false;
  82.     }
  83. }