src/Entity/Content/Parts/TextBlockTranslation.php line 12

  1. <?php
  2. namespace App\Entity\Content\Parts;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Knp\DoctrineBehaviors\Contract\Entity\TranslationInterface;
  5. use Knp\DoctrineBehaviors\Model\Translatable\TranslationTrait;
  6. use Symfony\Component\Validator\Constraints as Assert;
  7. #[ORM\Table(name'content_textblock_translation')]
  8. #[ORM\Entity]
  9. class TextBlockTranslation implements TranslationInterface
  10. {
  11.     use TranslationTrait {
  12.         isEmpty as ttEmpty;
  13.     }
  14.     #[ORM\Id]
  15.     #[ORM\Column(type'integer')]
  16.     #[ORM\GeneratedValue(strategy'AUTO')]
  17.     private ?int $id;
  18.     /**
  19.      * @var string|null
  20.      */
  21.     #[ORM\Column(type'string')]
  22.     #[Assert\NotBlank]
  23.     private ?string $caption null;
  24.     /**
  25.      * @var string|null
  26.      */
  27.     #[ORM\Column(type'text'nullabletrue)]
  28.     private ?string $content null;
  29.     public function isEmpty(): bool
  30.     {
  31.         $parentResult $this->ttEmpty();
  32.         if ($parentResult) {
  33.             return true;
  34.         }
  35.         if (empty($this->caption)) {
  36.             return true;
  37.         }
  38.         return false;
  39.     }
  40.     /**
  41.      * @return string|null
  42.      */
  43.     public function getCaption(): ?string
  44.     {
  45.         return $this->caption;
  46.     }
  47.     /**
  48.      * @param string|null $caption
  49.      */
  50.     public function setCaption(?string $caption): void
  51.     {
  52.         $this->caption $caption;
  53.     }
  54.     /**
  55.      * @return string|null
  56.      */
  57.     public function getContent(): ?string
  58.     {
  59.         return $this->content;
  60.     }
  61.     /**
  62.      * @param string|null $content
  63.      */
  64.     public function setContent(?string $content): void
  65.     {
  66.         $this->content $content;
  67.     }
  68.     /**
  69.      * @return int|null
  70.      */
  71.     public function getId(): ?int
  72.     {
  73.         return $this->id;
  74.     }
  75.     /**
  76.      * @param int|null $id
  77.      */
  78.     public function setId(?int $id): void
  79.     {
  80.         $this->id $id;
  81.     }
  82. }