src/Entity/BannerTranslation.php line 18

  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use ApiPlatform\Metadata\ApiResource,
  5.     ApiPlatform\Metadata\Get;
  6. use App\Enum\Language,
  7.     App\Repository\BannerTranslationRepository;
  8. #[ApiResource(
  9.     security'is_granted("' Banner::class . '")',
  10.     operations: [ new Get() ],
  11.     extraProperties: ['standard_put' => false],
  12. )]
  13. #[ORM\Entity(repositoryClassBannerTranslationRepository::class)]
  14. class BannerTranslation extends AbstractBannerTranslation
  15. {
  16.     public function __construct(Banner $parentLanguage $lang)
  17.     {
  18.         parent::__construct($parent$lang);
  19.     }
  20.     public function setTitle(?string $title): self
  21.     {
  22.         $this->title $title;
  23.         /** @var Banner */
  24.         $parent $this->parent;
  25.         if ($this->lang === $parent->getNativeLanguage()) {
  26.             $parent->setNativeTitle($title);
  27.         }
  28.         return $this;
  29.     }
  30. }