src/Entity/Content/Parts/TextBlock.php line 25

  1. <?php
  2. namespace App\Entity\Content\Parts;
  3. use App\Entity\Common\Owner;
  4. use App\Entity\Traits\ActiveTrait;
  5. use App\Entity\Traits\TrackerFields;
  6. use App\Entity\Traits\UserCreatedInterface;
  7. use App\Entity\Traits\UserUpdatedInterface;
  8. use App\Entity\Traits\WeightTrait;
  9. use App\Model\Translation\TranslatableTrait;
  10. use Doctrine\ORM\Mapping as ORM;
  11. use Knp\DoctrineBehaviors\Contract\Entity\TranslatableInterface;
  12. use Symfony\Component\Validator\Constraints as Assert;
  13. /**
  14.  * @method getCaption()
  15.  */
  16. #[ORM\Table(name'content_textblock')]
  17. #[ORM\Index(name'idx_owner'columns: ['owner_uuid''deleted''active'])]
  18. #[ORM\Index(name'idx_show'columns: ['slug''owner_uuid''deleted''active'])]
  19. #[ORM\Entity(repositoryClass\App\Repository\Content\Parts\TextBlockRepository::class)]
  20. #[ORM\HasLifecycleCallbacks]
  21. class TextBlock implements UserCreatedInterfaceUserUpdatedInterfaceTranslatableInterface
  22. {
  23.     use TranslatableTrait;
  24.     use TrackerFields;
  25.     use ActiveTrait;
  26.     use WeightTrait;
  27.     /**
  28.      * @var int|null
  29.      */
  30.     #[ORM\Id]
  31.     #[ORM\GeneratedValue(strategy'AUTO')]
  32.     #[ORM\Column(type'integer')]
  33.     private $id;
  34.     /**
  35.      * @var string|null
  36.      */
  37.     #[ORM\Column(type'string'length100)]
  38.     #[Assert\NotBlank]
  39.     private $slug;
  40.     /**
  41.      * @var string|null
  42.      *
  43.      */
  44.     #[ORM\Column(type'string'nullabletrue)]
  45.     private $caption;
  46.     /**
  47.      * @var string|null
  48.      */
  49.     #[ORM\Column(type'text'nullabletrue)]
  50.     private $content;
  51.     /**
  52.      * @var bool
  53.      */
  54.     #[ORM\Column(type'boolean'options: ['default' => 1])]
  55.     private bool $showCaption=true;
  56.     /**
  57.      * @var bool
  58.      */
  59.     #[ORM\Column(type'boolean'options: ['default' => 0])]
  60.     private bool $mainMenu=false;
  61.     /**
  62.      * @var Owner
  63.      */
  64.     #[ORM\Embedded(class: 'App\Entity\Common\Owner')]
  65.     private Owner $owner;
  66.     public function __construct()
  67.     {
  68.         $this->owner = new Owner();
  69.     }
  70.     /**
  71.      * @return int|null
  72.      */
  73.     public function getId(): ?int
  74.     {
  75.         return $this->id;
  76.     }
  77.     /**
  78.      * @param int|null $id
  79.      */
  80.     public function setId(?int $id): void
  81.     {
  82.         $this->id $id;
  83.     }
  84.     /**
  85.      * @return string|null
  86.      */
  87.     public function getSlug(): ?string
  88.     {
  89.         return $this->slug;
  90.     }
  91.     /**
  92.      * @param string|null $slug
  93.      */
  94.     public function setSlug(?string $slug): void
  95.     {
  96.         $this->slug $slug;
  97.     }
  98.     /**
  99.      * @return Owner
  100.      */
  101.     public function getOwner(): Owner
  102.     {
  103.         return $this->owner;
  104.     }
  105.     /**
  106.      * @param Owner $owner
  107.      */
  108.     public function setOwner(Owner $owner): void
  109.     {
  110.         $this->owner $owner;
  111.     }
  112.     /**
  113.      * @return bool
  114.      */
  115.     public function isMainMenu(): bool
  116.     {
  117.         return $this->mainMenu;
  118.     }
  119.     /**
  120.      * @param bool $mainMenu
  121.      */
  122.     public function setMainMenu(bool $mainMenu): void
  123.     {
  124.         $this->mainMenu $mainMenu;
  125.     }
  126.     /**
  127.      * @return bool
  128.      */
  129.     public function isShowCaption(): bool
  130.     {
  131.         return $this->showCaption;
  132.     }
  133.     /**
  134.      * @param bool $showCaption
  135.      */
  136.     public function setShowCaption(bool $showCaption): void
  137.     {
  138.         $this->showCaption $showCaption;
  139.     }
  140. }