src/Entity/Content/MaterialTranslation.php line 17

  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\Table(name'material_translation')]
  13. #[ORM\Entity]
  14. class MaterialTranslation implements TranslationInterface
  15. {
  16.     use TranslationTrait {
  17.         isEmpty as ttEmpty;
  18.     }
  19.     #[ORM\Id]
  20.     #[ORM\Column(type'integer')]
  21.     #[ORM\GeneratedValue(strategy'AUTO')]
  22.     private ?int $id;
  23.     #[ORM\Column(type'string')]
  24.     private ?string $caption;
  25.     public function isEmpty(): bool
  26.     {
  27.         $parentResult $this->ttEmpty();
  28.         if ($parentResult) {
  29.             return true;
  30.         }
  31.         if (empty($this->caption)) {
  32.             return true;
  33.         }
  34.         return false;
  35.     }
  36.     /**
  37.      * @return int|null
  38.      */
  39.     public function getId(): ?int
  40.     {
  41.         return $this->id;
  42.     }
  43.     /**
  44.      * @param int|null $id
  45.      */
  46.     public function setId(?int $id): void
  47.     {
  48.         $this->id $id;
  49.     }
  50.     /**
  51.      * @return string|null
  52.      */
  53.     public function getCaption(): ?string
  54.     {
  55.         return $this->caption;
  56.     }
  57.     /**
  58.      * @param string|null $caption
  59.      */
  60.     public function setCaption(?string $caption): void
  61.     {
  62.         $this->caption $caption;
  63.     }
  64. }