src/Entity/LandingTranslation.php line 31

  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\ApiProperty,
  7.     ApiPlatform\Metadata\ApiResource,
  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. use App\Attribute\Sanitizeable,
  15.     App\Enum\Language,
  16.     App\Repository\LandingTranslationRepository;
  17. use App\Entity\Trait\Media\MediaTrait;
  18. #[ApiResource(
  19.     security'is_granted("' News::class . '")',
  20.     operations: [ new Get() ],
  21.     extraProperties: ['standard_put' => false],
  22. )]
  23. #[ORM\Entity(repositoryClassLandingTranslationRepository::class)]
  24. class LandingTranslation implements TranslationInterface
  25. {
  26.     use IdTrait,
  27.         UuidTrait,
  28.         TimestampableTrait,
  29.         TranslationTrait,
  30.         MediaTrait;
  31.     #[ApiProperty(description'Title')]
  32.     #[Groups(['read''write'])]
  33.     #[ORM\Column(typeTypes::STRINGlength511nullabletrue)]
  34.     private ?string $title null;
  35.     #[ApiProperty(description'Text')]
  36.     #[Groups(['read:' self::class, 'write'])]
  37.     #[Sanitizeable]
  38.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  39.     private ?string $text null;
  40.     #[ApiProperty(description'Alt')]
  41.     #[Groups(['read:' self::class, 'write'])]
  42.     #[ORM\Column(typeTypes::STRINGlength1023nullabletrue)]
  43.     private ?string $alt null;
  44.     public function __construct(Landing $parentLanguage $lang)
  45.     {
  46.         $this->setUuid();
  47.         $this->parent $parent;
  48.         $this->lang $lang;
  49.         $this->createdAt = new \DateTimeImmutable();
  50.         $this->updatedAt = new \DateTimeImmutable();
  51.         $parent->addTranslation($this);
  52.     }
  53.     public function getTitle(): ?string
  54.     {
  55.         return $this->title;
  56.     }
  57.     public function setTitle(?string $title): self
  58.     {
  59.         $this->title $title;
  60.         return $this;
  61.     }
  62.     public function getText(): ?string
  63.     {
  64.         return $this->text;
  65.     }
  66.     public function setText(?string $text): self
  67.     {
  68.         $this->text $text;
  69.         return $this;
  70.     }
  71.     public function getAlt(): ?string
  72.     {
  73.         return $this->alt;
  74.     }
  75.     public function setAlt(?string $alt): self
  76.     {
  77.         $this->alt $alt;
  78.         return $this;
  79.     }
  80. }