<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity (repositoryClass="App\Repository\WebPageRepository")
*/
class WebPage
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $name;
/**
* @var \Doctrine\Common\Collections\Collection
*
* @ORM\OneToMany(targetEntity="App\Entity\WebPageBlock", mappedBy="webPage", cascade={"persist","remove"})
* @ORM\OrderBy({"ordering" = "ASC"})
*/
private $blocks;
/**
* @var \Doctrine\Common\Collections\Collection
*
* @ORM\OneToMany(targetEntity="App\Entity\WebList", mappedBy="webPage", cascade={"persist"})
*/
private $webLists;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\User", inversedBy="webPages")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="owner_id", referencedColumnName="id")
* })
*/
private $owner;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\DnsitEntity", inversedBy="webPages")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="entity_id", referencedColumnName="id")
* })
*/
private $entity;
/**
* @ORM\ManyToMany(targetEntity="App\Entity\Tag", inversedBy="webPages")
*/
private $tags;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $createdAt;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $updatedAt;
/**
* @ORM\Column(type="integer", nullable=true, options={"default":0, "comment":"code de statut : 0=OK"})
*/
private $state;
/**
* @ORM\ManyToOne(targetEntity=WebPageTemplate::class, inversedBy="webPages")
*/
private $template;
/**
* @ORM\OneToMany(targetEntity=WebPageParameter::class, mappedBy="webPage", orphanRemoval=true, cascade={"persist", "remove"})
*/
private $parameters;
public function __construct()
{
$this->blocks = new ArrayCollection();
$this->webLists = new ArrayCollection();
$this->tags = new ArrayCollection();
$this->parameters = new ArrayCollection();
}
public function getId() : ?int
{
return $this->id;
}
public function getName() : ?string
{
return $this->name;
}
public function setName(?string $name) : self
{
$this->name = $name;
return $this;
}
public function getCreatedAt() : ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(?\DateTimeInterface $createdAt) : self
{
$this->createdAt = $createdAt;
return $this;
}
public function getUpdatedAt() : ?\DateTimeInterface
{
return $this->updatedAt;
}
public function setUpdatedAt(?\DateTimeInterface $updatedAt) : self
{
$this->updatedAt = $updatedAt;
return $this;
}
public function getState() : ?int
{
return $this->state;
}
public function setState(?int $state) : self
{
$this->state = $state;
return $this;
}
public function getOwner() : ?User
{
return $this->owner;
}
public function setOwner(?User $owner) : self
{
$this->owner = $owner;
return $this;
}
public function getEntity() : ?DnsitEntity
{
return $this->entity;
}
public function setEntity(?DnsitEntity $entity) : self
{
$this->entity = $entity;
return $this;
}
/**
* @return Collection|WebPageBlock[]
*/
public function getBlocks() : Collection
{
return $this->blocks;
}
public function addBlock(WebPageBlock $block) : self
{
if (!$this->blocks->contains($block)) {
$this->blocks[] = $block;
$block->setWebPage($this);
}
return $this;
}
public function removeBlock(WebPageBlock $block) : self
{
if ($this->blocks->contains($block)) {
$this->blocks->removeElement($block);
// set the owning side to null (unless already changed)
if ($block->getWebPage() === $this) {
$block->setWebPage(null);
}
}
return $this;
}
/**
* @return Collection|WebList[]
*/
public function getWebLists() : Collection
{
return $this->webLists;
}
public function addWebList(WebList $webList) : self
{
if (!$this->webLists->contains($webList)) {
$this->webLists[] = $webList;
$webList->setWebPage($this);
}
return $this;
}
public function removeWebList(WebList $webList) : self
{
if ($this->webLists->contains($webList)) {
$this->webLists->removeElement($webList);
// set the owning side to null (unless already changed)
if ($webList->getWebPage() === $this) {
$webList->setWebPage(null);
}
}
return $this;
}
/**
* @return Collection|Tag[]
*/
public function getTags() : Collection
{
return $this->tags;
}
public function addTag(Tag $tag) : self
{
if (!$this->tags->contains($tag)) {
$this->tags[] = $tag;
}
return $this;
}
public function removeTag(Tag $tag) : self
{
if ($this->tags->contains($tag)) {
$this->tags->removeElement($tag);
}
return $this;
}
public function getTemplate() : ?WebPageTemplate
{
return $this->template;
}
public function setTemplate(?WebPageTemplate $template) : self
{
$this->template = $template;
return $this;
}
/**
* @return Collection|WebPageParameter[]
*/
public function getParameters() : Collection
{
return $this->parameters;
}
public function addParameter(WebPageParameter $parameter) : self
{
if (!$this->parameters->contains($parameter)) {
$this->parameters[] = $parameter;
$parameter->setWebPage($this);
}
return $this;
}
public function removeParameter(WebPageParameter $parameter) : self
{
if ($this->parameters->removeElement($parameter)) {
// set the owning side to null (unless already changed)
if ($parameter->getWebPage() === $this) {
$parameter->setWebPage(null);
}
}
return $this;
}
}