src/Entity/Content/NewsTranslation.php line 16

  1. <?php
  2. /**
  3.  * Created by PhpStorm.
  4.  * User: Михаил
  5.  * Date: 21.12.2018
  6.  * Time: 11:20
  7.  */
  8. namespace App\Entity\Content;
  9. use Doctrine\ORM\Mapping as ORM;
  10. use Knp\DoctrineBehaviors\Contract\Entity\TranslationInterface;
  11. use Knp\DoctrineBehaviors\Model\Translatable\TranslationTrait;
  12. #[ORM\Entity]
  13. class NewsTranslation implements TranslationInterface
  14. {
  15.     use TranslationTrait {
  16.         isEmpty as ttEmpty;
  17.     }
  18.     #[ORM\Id]
  19.     #[ORM\Column(type'integer')]
  20.     #[ORM\GeneratedValue(strategy'AUTO')]
  21.     private ?int $id;
  22.     #[ORM\Column(type'string')]
  23.     private ?string $caption null;
  24.     #[ORM\Column(type'string'length250nullabletrue)]
  25.     private ?string $subtitle null;
  26.     #[ORM\Column(type'text'nullabletrue)]
  27.     private ?string $preview null;
  28.     #[ORM\Column(type'text'nullabletrue)]
  29.     private ?string $text null;
  30.     public function isEmpty(): bool
  31.     {
  32.         $parentResult $this->ttEmpty();
  33.         if ($parentResult) {
  34.             return true;
  35.         }
  36.         if (empty($this->caption)) {
  37.             return true;
  38.         }
  39.         if (empty($this->text)) {
  40.             return true;
  41.         }
  42.         return false;
  43.     }
  44.     /**
  45.      * @return int|null
  46.      */
  47.     public function getId(): ?int
  48.     {
  49.         return $this->id;
  50.     }
  51.     /**
  52.      * @param int|null $id
  53.      */
  54.     public function setId(?int $id): void
  55.     {
  56.         $this->id $id;
  57.     }
  58.     /**
  59.      * @return string|null
  60.      */
  61.     public function getCaption(): ?string
  62.     {
  63.         return $this->caption;
  64.     }
  65.     /**
  66.      * @param string|null $caption
  67.      */
  68.     public function setCaption(?string $caption): void
  69.     {
  70.         $this->caption $caption;
  71.     }
  72.     /**
  73.      * @return string|null
  74.      */
  75.     public function getSubtitle(): ?string
  76.     {
  77.         return $this->subtitle;
  78.     }
  79.     /**
  80.      * @param string|null $subtitle
  81.      */
  82.     public function setSubtitle(?string $subtitle): void
  83.     {
  84.         $this->subtitle $subtitle;
  85.     }
  86.     /**
  87.      * @return string|null
  88.      */
  89.     public function getPreview(): ?string
  90.     {
  91.         return $this->preview;
  92.     }
  93.     /**
  94.      * @param string|null $preview
  95.      */
  96.     public function setPreview(?string $preview): void
  97.     {
  98.         $this->preview $preview;
  99.     }
  100.     /**
  101.      * @return string|null
  102.      */
  103.     public function getText(): ?string
  104.     {
  105.         return $this->text;
  106.     }
  107.     /**
  108.      * @param string|null $text
  109.      */
  110.     public function setText(?string $text): void
  111.     {
  112.         $this->text $text;
  113.     }
  114. }