<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Serializer\Annotation\MaxDepth;
/**
* @ORM\Entity(repositoryClass="App\Repository\ListModelRepository")
*/
class ListModel
{
/**
* @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\WebListBlock", mappedBy="listModel", cascade={"persist","remove"})
*/
private $blocks;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\User", inversedBy="listModels")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="owner_id", referencedColumnName="id")
* })
*/
private $owner;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\DnsitEntity", inversedBy="listModels")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="entity_id", referencedColumnName="id")
* })
*/
private $entity;
/**
* @ORM\ManyToMany(targetEntity="App\Entity\Tag", inversedBy="listModels")
*/
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=WebListTemplate::class, inversedBy="listModels")
*/
private $listTemplate;
/**
* @ORM\ManyToOne(targetEntity=WebListItemTemplate::class, inversedBy="listModels")
*/
private $listItemTemplate;
/**
* @ORM\OneToMany(targetEntity=WebListParameter::class, mappedBy="listModel", orphanRemoval=true, cascade={"persist", "remove"})
*/
private $parameters;
/**
* @ORM\Column(type="string", length=255, options={"default" : "NONE"})
*/
private $duplicateProductsBy = 'NONE';
/**
* @var \Doctrine\Common\Collections\Collection
*
* @ORM\OneToMany(targetEntity="App\Entity\WebList", mappedBy="listModel", cascade={"persist"})
*/
private $weblists;
public function __construct()
{
$this->weblists = new ArrayCollection();
$this->blocks = 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|WebListBlock[]
*/
public function getBlocks(): Collection
{
return $this->blocks;
}
public function addBlock(WebListBlock $block): self
{
if (!$this->blocks->contains($block)) {
$this->blocks[] = $block;
$block->setListModel($this);
}
return $this;
}
public function removeBlock(WebListBlock $block): self
{
if ($this->blocks->contains($block)) {
$this->blocks->removeElement($block);
// set the owning side to null (unless already changed)
if ($block->getListModel() === $this) {
$block->setListModel(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 getListTemplate(): ?WebListTemplate
{
return $this->listTemplate;
}
public function setListTemplate(?WebListTemplate $listTemplate): self
{
$this->listTemplate = $listTemplate;
return $this;
}
public function getListItemTemplate(): ?WebListItemTemplate
{
return $this->listItemTemplate;
}
public function setListItemTemplate(?WebListItemTemplate $listItemTemplate): self
{
$this->listItemTemplate = $listItemTemplate;
return $this;
}
public function getDuplicateProductsBy(): ?string
{
return $this->duplicateProductsBy;
}
public function setDuplicateProductsBy(?string $duplicateProductsBy): self
{
$this->duplicateProductsBy = $duplicateProductsBy;
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->setListModel($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->getsListModel() === $this) {
$weblist->setListModel(null);
}
}
return $this;
}
/**
* @return Collection|WebListParameter[]
*/
public function getParameters(): Collection
{
return $this->parameters;
}
public function addParameter(WebListParameter $parameter): self
{
if (!$this->parameters->contains($parameter)) {
$this->parameters[] = $parameter;
$parameter->setListModel($this);
}
return $this;
}
public function removeParameter(WebListParameter $parameter): self
{
if ($this->parameters->removeElement($parameter)) {
// set the owning side to null (unless already changed)
if ($parameter->getListModel() === $this) {
$parameter->setListModel(null);
}
}
return $this;
}
}