src/Entity/Cms.php line 12
<?phpnamespace App\Entity;use App\Repository\CmsRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: CmsRepository::class)]class Cms{const PAGE = 'Page';const BLOCK = 'Block';/*'Module','Banner','CTA','Video'*/#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[ORM\Column(length: 255)]private ?string $type = null;#[ORM\Column(length: 255)]private ?string $title = null;#[ORM\Column(length: 255, nullable: true)]private ?string $subTitle = null;#[ORM\Column(type: Types::TEXT)]private ?string $content = null;#[ORM\OneToOne(cascade: ['persist', 'remove'])]private ?Attachment $background = null;#[ORM\OneToOne(cascade: ['persist', 'remove'])]private ?Attachment $image = null;#[ORM\Column]private ?\DateTimeImmutable $createdAt = null;#[ORM\Column]private ?\DateTimeImmutable $updatedAt = null;#[ORM\Column(length: 255)]private ?string $direction = null;#[ORM\Column]private ?bool $isPublic = false;#[ORM\ManyToOne(inversedBy: 'cms')]private ?User $createdBy = null;#[ORM\ManyToOne(targetEntity: self::class, inversedBy: 'blocks')]private ?self $parent = null;#[ORM\OneToMany(mappedBy: 'parent', targetEntity: self::class)]private Collection $blocks;#[ORM\Column(length: 255, nullable: true)]private ?string $path = null;#[ORM\Column(length: 255, nullable: true)]private ?string $url = null;#[ORM\Column]private ?bool $isMenu = false;public function __construct(){if (!$this->createdAt)$this->createdAt = new \DateTimeImmutable();$this->updatedAt = new \DateTimeImmutable();$this->blocks = new ArrayCollection();}public static function getTypes(){return [self::PAGE,'Block','Module','Banner','CTA','Video'];}public static function getDirections(){return ['none','Left','Right','Top','Bottom','Center',];}public function getId(): ?int{return $this->id;}public function getType(): ?string{return $this->type;}public function setType(string $type): self{$this->type = $type;return $this;}public function getTitle(): ?string{return $this->title;}public function setTitle(string $title): self{$this->title = $title;return $this;}public function getSubTitle(): ?string{return $this->subTitle;}public function setSubTitle(?string $subTitle): self{$this->subTitle = $subTitle;return $this;}public function getContent(): ?string{return $this->content;}public function setContent(string $content): self{$this->content = $content;return $this;}public function getBackground(): ?Attachment{return $this->background;}public function setBackground(?Attachment $background): self{$this->background = $background;return $this;}public function getImage(): ?Attachment{return $this->image;}public function setImage(?Attachment $image): self{$this->image = $image;return $this;}public function getCreatedAt(): ?\DateTimeImmutable{return $this->createdAt;}public function setCreatedAt(\DateTimeImmutable $createdAt): self{$this->createdAt = $createdAt;return $this;}public function getUpdatedAt(): ?\DateTimeImmutable{return $this->updatedAt;}public function setUpdatedAt(\DateTimeImmutable $updatedAt): self{$this->updatedAt = $updatedAt;return $this;}public function getDirection(): ?string{return $this->direction;}public function setDirection(string $direction): self{$this->direction = $direction;return $this;}public function isIsPublic(): ?bool{return $this->isPublic;}public function setIsPublic(bool $isPublic): self{$this->isPublic = $isPublic;return $this;}public function getCreatedBy(): ?User{return $this->createdBy;}public function setCreatedBy(?User $createdBy): self{$this->createdBy = $createdBy;return $this;}public function getParent(): ?self{return $this->parent;}public function setParent(?self $parent): self{$this->parent = $parent;return $this;}/*** @return Collection<int, self>*/public function getBlocks(): Collection{return $this->blocks;}public function addBlock(self $block): self{if (!$this->blocks->contains($block)) {$this->blocks->add($block);$block->setParent($this);}return $this;}public function removeBlock(self $block): self{if ($this->blocks->removeElement($block)) {// set the owning side to null (unless already changed)if ($block->getParent() === $this) {$block->setParent(null);}}return $this;}public function getPath(): ?string{return $this->path;}public function setPath(?string $path): self{$this->path = $path;return $this;}public function getUrl(): ?string{return $this->url;}public function setUrl(?string $url): self{$this->url = $url;return $this;}public function isIsMenu(): ?bool{return $this->isMenu;}public function setIsMenu(bool $isMenu): self{$this->isMenu = $isMenu;return $this;}}