src/Entity/ListModel.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Component\Serializer\Annotation\Groups;
  7. use Symfony\Component\Serializer\Annotation\MaxDepth;
  8. /**
  9.  * @ORM\Entity(repositoryClass="App\Repository\ListModelRepository")
  10.  */
  11. class ListModel
  12. {
  13.     /**
  14.      * @ORM\Id()
  15.      * @ORM\GeneratedValue()
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\Column(type="string", length=255, nullable=true)
  21.      */
  22.     private $name;
  23.     /**
  24.      * @var \Doctrine\Common\Collections\Collection
  25.      *
  26.      * @ORM\OneToMany(targetEntity="App\Entity\WebListBlock", mappedBy="listModel", cascade={"persist","remove"})
  27.      */
  28.     private $blocks;
  29.     /**
  30.      * @ORM\ManyToOne(targetEntity="App\Entity\User", inversedBy="listModels")
  31.      * @ORM\JoinColumns({
  32.      *   @ORM\JoinColumn(name="owner_id", referencedColumnName="id")
  33.      * })
  34.      */
  35.     private $owner;
  36.     /**
  37.      * @ORM\ManyToOne(targetEntity="App\Entity\DnsitEntity", inversedBy="listModels")
  38.      * @ORM\JoinColumns({
  39.      *   @ORM\JoinColumn(name="entity_id", referencedColumnName="id")
  40.      * })
  41.      */
  42.     private $entity;
  43.     /**
  44.      * @ORM\ManyToMany(targetEntity="App\Entity\Tag", inversedBy="listModels")
  45.      */
  46.     private $tags;
  47.     /**
  48.      * @ORM\Column(type="datetime", nullable=true)
  49.      */
  50.     private $createdAt;
  51.     /**
  52.      * @ORM\Column(type="datetime", nullable=true)
  53.      */
  54.     private $updatedAt;
  55.     /**
  56.      * @ORM\Column(type="integer", nullable=true, options={"default":0, "comment":"code de statut : 0=OK"})
  57.      */
  58.     private $state;
  59.     /**
  60.      * @ORM\ManyToOne(targetEntity=WebListTemplate::class, inversedBy="listModels")
  61.      */
  62.     private $listTemplate;
  63.     /**
  64.      * @ORM\ManyToOne(targetEntity=WebListItemTemplate::class, inversedBy="listModels")
  65.      */
  66.     private $listItemTemplate;
  67.     /**
  68.      * @ORM\OneToMany(targetEntity=WebListParameter::class, mappedBy="listModel", orphanRemoval=true, cascade={"persist", "remove"})
  69.      */
  70.     private $parameters;
  71.     /**
  72.      * @ORM\Column(type="string", length=255, options={"default" : "NONE"})
  73.      */
  74.     private $duplicateProductsBy 'NONE';
  75.     /**
  76.      * @var \Doctrine\Common\Collections\Collection
  77.      *
  78.      * @ORM\OneToMany(targetEntity="App\Entity\WebList", mappedBy="listModel", cascade={"persist"})
  79.      */
  80.     private $weblists;
  81.     public function __construct()
  82.     {
  83.         $this->weblists = new ArrayCollection();
  84.         $this->blocks = new ArrayCollection();
  85.         $this->tags = new ArrayCollection();
  86.         $this->parameters = new ArrayCollection();
  87.     }
  88.     public function getId(): ?int
  89.     {
  90.         return $this->id;
  91.     }
  92.     public function getName(): ?string
  93.     {
  94.         return $this->name;
  95.     }
  96.     public function setName(?string $name): self
  97.     {
  98.         $this->name $name;
  99.         return $this;
  100.     }
  101.     public function getCreatedAt(): ?\DateTimeInterface
  102.     {
  103.         return $this->createdAt;
  104.     }
  105.     public function setCreatedAt(?\DateTimeInterface $createdAt): self
  106.     {
  107.         $this->createdAt $createdAt;
  108.         return $this;
  109.     }
  110.     public function getUpdatedAt(): ?\DateTimeInterface
  111.     {
  112.         return $this->updatedAt;
  113.     }
  114.     public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
  115.     {
  116.         $this->updatedAt $updatedAt;
  117.         return $this;
  118.     }
  119.     public function getState(): ?int
  120.     {
  121.         return $this->state;
  122.     }
  123.     public function setState(?int $state): self
  124.     {
  125.         $this->state $state;
  126.         return $this;
  127.     }
  128.     public function getOwner(): ?User
  129.     {
  130.         return $this->owner;
  131.     }
  132.     public function setOwner(?User $owner): self
  133.     {
  134.         $this->owner $owner;
  135.         return $this;
  136.     }
  137.     public function getEntity(): ?DnsitEntity
  138.     {
  139.         return $this->entity;
  140.     }
  141.     public function setEntity(?DnsitEntity $entity): self
  142.     {
  143.         $this->entity $entity;
  144.         return $this;
  145.     }
  146.     /**
  147.      * @return Collection|WebListBlock[]
  148.      */
  149.     public function getBlocks(): Collection
  150.     {
  151.         return $this->blocks;
  152.     }
  153.     public function addBlock(WebListBlock $block): self
  154.     {
  155.         if (!$this->blocks->contains($block)) {
  156.             $this->blocks[] = $block;
  157.             $block->setListModel($this);
  158.         }
  159.         return $this;
  160.     }
  161.     public function removeBlock(WebListBlock $block): self
  162.     {
  163.         if ($this->blocks->contains($block)) {
  164.             $this->blocks->removeElement($block);
  165.             // set the owning side to null (unless already changed)
  166.             if ($block->getListModel() === $this) {
  167.                 $block->setListModel(null);
  168.             }
  169.         }
  170.         return $this;
  171.     }
  172.     /**
  173.      * @return Collection|Tag[]
  174.      */
  175.     public function getTags(): Collection
  176.     {
  177.         return $this->tags;
  178.     }
  179.     public function addTag(Tag $tag): self
  180.     {
  181.         if (!$this->tags->contains($tag)) {
  182.             $this->tags[] = $tag;
  183.         }
  184.         return $this;
  185.     }
  186.     public function removeTag(Tag $tag): self
  187.     {
  188.         if ($this->tags->contains($tag)) {
  189.             $this->tags->removeElement($tag);
  190.         }
  191.         return $this;
  192.     }
  193.     public function getListTemplate(): ?WebListTemplate
  194.     {
  195.         return $this->listTemplate;
  196.     }
  197.     public function setListTemplate(?WebListTemplate $listTemplate): self
  198.     {
  199.         $this->listTemplate $listTemplate;
  200.         return $this;
  201.     }
  202.     public function getListItemTemplate(): ?WebListItemTemplate
  203.     {
  204.         return $this->listItemTemplate;
  205.     }
  206.     public function setListItemTemplate(?WebListItemTemplate $listItemTemplate): self
  207.     {
  208.         $this->listItemTemplate $listItemTemplate;
  209.         return $this;
  210.     }
  211.     public function getDuplicateProductsBy(): ?string
  212.     {
  213.         return $this->duplicateProductsBy;
  214.     }
  215.     public function setDuplicateProductsBy(?string $duplicateProductsBy): self
  216.     {
  217.         $this->duplicateProductsBy $duplicateProductsBy;
  218.         return $this;
  219.     }
  220.     /**
  221.      * @return Collection|WebList[]
  222.      */
  223.     public function getWeblists(): Collection
  224.     {
  225.         return $this->weblists;
  226.     }
  227.     public function addWeblist(WebList $weblist): self
  228.     {
  229.         if (!$this->weblists->contains($weblist)) {
  230.             $this->weblists[] = $weblist;
  231.             $weblist->setListModel($this);
  232.         }
  233.         return $this;
  234.     }
  235.     public function removeWeblist(WebList $weblist): self
  236.     {
  237.         if ($this->weblists->contains($weblist)) {
  238.             $this->weblists->removeElement($weblist);
  239.             // set the owning side to null (unless already changed)
  240.             if ($weblist->getsListModel() === $this) {
  241.                 $weblist->setListModel(null);
  242.             }
  243.         }
  244.         return $this;
  245.     }
  246.     /**
  247.      * @return Collection|WebListParameter[]
  248.      */
  249.     public function getParameters(): Collection
  250.     {
  251.         return $this->parameters;
  252.     }
  253.     public function addParameter(WebListParameter $parameter): self
  254.     {
  255.         if (!$this->parameters->contains($parameter)) {
  256.             $this->parameters[] = $parameter;
  257.             $parameter->setListModel($this);
  258.         }
  259.         return $this;
  260.     }
  261.     public function removeParameter(WebListParameter $parameter): self
  262.     {
  263.         if ($this->parameters->removeElement($parameter)) {
  264.             // set the owning side to null (unless already changed)
  265.             if ($parameter->getListModel() === $this) {
  266.                 $parameter->setListModel(null);
  267.             }
  268.         }
  269.         return $this;
  270.     }
  271. }