src/Entity/JournalCollectionTranslation.php line 33

  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM,
  4.     Doctrine\DBAL\Types\Types,
  5.     Doctrine\Common\Collections\ArrayCollection;
  6. use Symfony\Component\Serializer\Annotation\Groups;
  7. use ApiPlatform\Metadata\ApiProperty,
  8.     ApiPlatform\Metadata\ApiResource,
  9.     ApiPlatform\Metadata\Get;
  10. use App\Entity\Trait\IdTrait,
  11.     App\Entity\Trait\UuidTrait,
  12.     App\Entity\Trait\TimestampableTrait,
  13.     App\Entity\Trait\TranslationTrait,
  14.     App\Entity\Trait\Media\ImageThumbableTrait,
  15.     App\Entity\Trait\SlugTrait,
  16.     App\Entity\Interface\TranslationInterface,
  17.     App\Entity\Interface\ThumbableInterface;
  18. use App\Attribute\Sanitizeable,
  19.     App\Enum\Language,
  20.     App\Repository\JournalCollectionTranslationRepository;
  21. #[ApiResource(
  22.     security'is_granted("' Journal::class . '")',
  23.     operations: [ new Get() ],
  24.     extraProperties: ['standard_put' => false],
  25. )]
  26. #[ORM\Entity(repositoryClassJournalCollectionTranslationRepository::class)]
  27. class JournalCollectionTranslation implements TranslationInterfaceThumbableInterface
  28. {
  29.     use IdTrait,
  30.         UuidTrait,
  31.         TimestampableTrait,
  32.         TranslationTrait,
  33.         ImageThumbableTrait,
  34.         SlugTrait;
  35.     #[ApiProperty(description'Title')]
  36.     #[Groups(['read''write'])]
  37.     #[ORM\Column(typeTypes::STRINGlength511nullabletrue)]
  38.     private ?string $title null;
  39.     #[ApiProperty(description'Description')]
  40.     #[Groups(['read:' self::class, 'write'])]
  41.     #[Sanitizeable]
  42.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  43.     private ?string $description null;
  44.     #[ApiProperty(description'Alt')]
  45.     #[Groups(['read:' self::class, 'write'])]
  46.     #[ORM\Column(typeTypes::STRINGlength511nullabletrue)]
  47.     private ?string $alt null;
  48.     public function __construct(JournalCollection $parentLanguage $lang)
  49.     {
  50.         $this->setUuid();
  51.         $this->parent $parent;
  52.         $this->lang $lang;
  53.         $this->thumbs = new ArrayCollection();
  54.         $this->createdAt = new \DateTimeImmutable();
  55.         $this->updatedAt = new \DateTimeImmutable();
  56.         $parent->addTranslation($this);
  57.     }
  58.     public function getTitle(): ?string
  59.     {
  60.         return $this->title;
  61.     }
  62.     public function setTitle(?string $title): self
  63.     {
  64.         $this->title $title;
  65.         return $this;
  66.     }
  67.     public function getDescription(): ?string
  68.     {
  69.         return $this->description;
  70.     }
  71.     public function setDescription(?string $description): self
  72.     {
  73.         $this->description $description;
  74.         return $this;
  75.     }
  76.     public function getAlt(): ?string
  77.     {
  78.         return $this->alt;
  79.     }
  80.     public function setAlt(?string $alt): self
  81.     {
  82.         $this->alt $alt;
  83.         return $this;
  84.     }
  85. }