<?php
namespace App\Entity\Content;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Knp\DoctrineBehaviors\Contract\Entity\TranslationInterface;
use Knp\DoctrineBehaviors\Model\Translatable\TranslationTrait;
use Knp\DoctrineBehaviors\Contract\Entity\TranslatableInterface;
use Knp\DoctrineBehaviors\Model as ORMBehaviors;
use App\Traits\ECommerce\DatesInterface;
use App\Traits\ECommerce\DatesTrait;
/**
* Page
*
* @ORM\Table(name="page")
* @ORM\Entity(repositoryClass="App\Repository\Content\PageRepository")
* @ORM\Cache(usage="READ_ONLY", region="public")
*/
class Page implements DatesInterface, TranslatableInterface
{
use ORMBehaviors\Translatable\TranslatableTrait;
use DatesTrait {
DatesTrait::__construct as __DT_construct;
}
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var bool
*
* @ORM\Column(name="home", type="boolean", options={"default":false})
*/
private $home = false;
/**
* @var Page
*
* @ORM\ManyToOne(targetEntity="App\Entity\Content\Page", inversedBy="children")
* @ORM\JoinColumn(name="parent", referencedColumnName="id", nullable=true)
*/
private $parent;
/**
* @var ArrayCollection
*
* @ORM\OneToMany(targetEntity="App\Entity\Content\Page", mappedBy="parent")
*/
private $children;
/**
* @var string
*
* @ORM\Column(name="style", type="text", nullable=true)
*/
private $style;
/**
* Constructor
*/
public function __construct()
{
$this->__DT_construct();
$this->children = new ArrayCollection();
}
/**
* Get id
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set home
*
* @param string $home
*/
public function setHome($home): static
{
$this->home = $home;
return $this;
}
/**
* Get home
*
* @return string
*/
public function getHome()
{
return $this->home;
}
/**
* Set parent
*
*
*/
public function setParent(Page $parent = null): static
{
$this->parent = $parent;
return $this;
}
/**
* Get parent
*
* @return Page
*/
public function getParent()
{
return $this->parent;
}
/**
* Add child
*
*
*/
public function addChild(Page $child): static
{
$this->children[] = $child;
return $this;
}
/**
* Remove child
*/
public function removeChild(Page $child): void
{
$this->children->removeElement($child);
}
/**
* Get children
*
* @return Collection
*/
public function getChildren()
{
return $this->children;
}
/**
* Set style
*
* @param string $style
*/
public function setStyle($style): static
{
$this->style = $style;
return $this;
}
/**
* Get style
*/
public function getStyle(): string
{
return (string)$this->style;
}
}