src/Entity/WebPage.php line 13

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. /**
  7.  * @ORM\Entity (repositoryClass="App\Repository\WebPageRepository")
  8.  */
  9. class WebPage
  10. {
  11.     /**
  12.      * @ORM\Id()
  13.      * @ORM\GeneratedValue()
  14.      * @ORM\Column(type="integer")
  15.      */
  16.     private $id;
  17.     /**
  18.      * @ORM\Column(type="string", length=255, nullable=true)
  19.      */
  20.     private $name;
  21.     /**
  22.      * @var \Doctrine\Common\Collections\Collection
  23.      *
  24.      * @ORM\OneToMany(targetEntity="App\Entity\WebPageBlock", mappedBy="webPage", cascade={"persist","remove"})
  25.      * @ORM\OrderBy({"ordering" = "ASC"})
  26.      */
  27.     private $blocks;
  28.     /**
  29.      * @var \Doctrine\Common\Collections\Collection
  30.      *
  31.      * @ORM\OneToMany(targetEntity="App\Entity\WebList", mappedBy="webPage", cascade={"persist"})
  32.      */
  33.     private $webLists;
  34.     /**
  35.      * @ORM\ManyToOne(targetEntity="App\Entity\User", inversedBy="webPages")
  36.      * @ORM\JoinColumns({
  37.      *   @ORM\JoinColumn(name="owner_id", referencedColumnName="id")
  38.      * })
  39.      */
  40.     private $owner;
  41.     /**
  42.      * @ORM\ManyToOne(targetEntity="App\Entity\DnsitEntity", inversedBy="webPages")
  43.      * @ORM\JoinColumns({
  44.      *   @ORM\JoinColumn(name="entity_id", referencedColumnName="id")
  45.      * })
  46.      */
  47.     private $entity;
  48.     /**
  49.      * @ORM\ManyToMany(targetEntity="App\Entity\Tag", inversedBy="webPages")
  50.      */
  51.     private $tags;
  52.     /**
  53.      * @ORM\Column(type="datetime", nullable=true)
  54.      */
  55.     private $createdAt;
  56.     /**
  57.      * @ORM\Column(type="datetime", nullable=true)
  58.      */
  59.     private $updatedAt;
  60.     /**
  61.      * @ORM\Column(type="integer", nullable=true, options={"default":0, "comment":"code de statut : 0=OK"})
  62.      */
  63.     private $state;
  64.     /**
  65.      * @ORM\ManyToOne(targetEntity=WebPageTemplate::class, inversedBy="webPages")
  66.      */
  67.     private $template;
  68.     /**
  69.      * @ORM\OneToMany(targetEntity=WebPageParameter::class, mappedBy="webPage", orphanRemoval=true, cascade={"persist", "remove"})
  70.      */
  71.     private $parameters;
  72.     public function __construct()
  73.     {
  74.         $this->blocks = new ArrayCollection();
  75.         $this->webLists = new ArrayCollection();
  76.         $this->tags = new ArrayCollection();
  77.         $this->parameters = new ArrayCollection();
  78.     }
  79.     public function getId() : ?int
  80.     {
  81.         return $this->id;
  82.     }
  83.     public function getName() : ?string
  84.     {
  85.         return $this->name;
  86.     }
  87.     public function setName(?string $name) : self
  88.     {
  89.         $this->name $name;
  90.         return $this;
  91.     }
  92.     public function getCreatedAt() : ?\DateTimeInterface
  93.     {
  94.         return $this->createdAt;
  95.     }
  96.     public function setCreatedAt(?\DateTimeInterface $createdAt) : self
  97.     {
  98.         $this->createdAt $createdAt;
  99.         return $this;
  100.     }
  101.     public function getUpdatedAt() : ?\DateTimeInterface
  102.     {
  103.         return $this->updatedAt;
  104.     }
  105.     public function setUpdatedAt(?\DateTimeInterface $updatedAt) : self
  106.     {
  107.         $this->updatedAt $updatedAt;
  108.         return $this;
  109.     }
  110.     public function getState() : ?int
  111.     {
  112.         return $this->state;
  113.     }
  114.     public function setState(?int $state) : self
  115.     {
  116.         $this->state $state;
  117.         return $this;
  118.     }
  119.     public function getOwner() : ?User
  120.     {
  121.         return $this->owner;
  122.     }
  123.     public function setOwner(?User $owner) : self
  124.     {
  125.         $this->owner $owner;
  126.         return $this;
  127.     }
  128.     public function getEntity() : ?DnsitEntity
  129.     {
  130.         return $this->entity;
  131.     }
  132.     public function setEntity(?DnsitEntity $entity) : self
  133.     {
  134.         $this->entity $entity;
  135.         return $this;
  136.     }
  137.     /**
  138.      * @return Collection|WebPageBlock[]
  139.      */
  140.     public function getBlocks() : Collection
  141.     {
  142.         return $this->blocks;
  143.     }
  144.     public function addBlock(WebPageBlock $block) : self
  145.     {
  146.         if (!$this->blocks->contains($block)) {
  147.             $this->blocks[] = $block;
  148.             $block->setWebPage($this);
  149.         }
  150.         return $this;
  151.     }
  152.     public function removeBlock(WebPageBlock $block) : self
  153.     {
  154.         if ($this->blocks->contains($block)) {
  155.             $this->blocks->removeElement($block);
  156.             // set the owning side to null (unless already changed)
  157.             if ($block->getWebPage() === $this) {
  158.                 $block->setWebPage(null);
  159.             }
  160.         }
  161.         return $this;
  162.     }
  163.     /**
  164.      * @return Collection|WebList[]
  165.      */
  166.     public function getWebLists() : Collection
  167.     {
  168.         return $this->webLists;
  169.     }
  170.     public function addWebList(WebList $webList) : self
  171.     {
  172.         if (!$this->webLists->contains($webList)) {
  173.             $this->webLists[] = $webList;
  174.             $webList->setWebPage($this);
  175.         }
  176.         return $this;
  177.     }
  178.     public function removeWebList(WebList $webList) : self
  179.     {
  180.         if ($this->webLists->contains($webList)) {
  181.             $this->webLists->removeElement($webList);
  182.             // set the owning side to null (unless already changed)
  183.             if ($webList->getWebPage() === $this) {
  184.                 $webList->setWebPage(null);
  185.             }
  186.         }
  187.         return $this;
  188.     }
  189.     /**
  190.      * @return Collection|Tag[]
  191.      */
  192.     public function getTags() : Collection
  193.     {
  194.         return $this->tags;
  195.     }
  196.     public function addTag(Tag $tag) : self
  197.     {
  198.         if (!$this->tags->contains($tag)) {
  199.             $this->tags[] = $tag;
  200.         }
  201.         return $this;
  202.     }
  203.     public function removeTag(Tag $tag) : self
  204.     {
  205.         if ($this->tags->contains($tag)) {
  206.             $this->tags->removeElement($tag);
  207.         }
  208.         return $this;
  209.     }
  210.     public function getTemplate() : ?WebPageTemplate
  211.     {
  212.         return $this->template;
  213.     }
  214.     public function setTemplate(?WebPageTemplate $template) : self
  215.     {
  216.         $this->template $template;
  217.         return $this;
  218.     }
  219.     /**
  220.      * @return Collection|WebPageParameter[]
  221.      */
  222.     public function getParameters() : Collection
  223.     {
  224.         return $this->parameters;
  225.     }
  226.     public function addParameter(WebPageParameter $parameter) : self
  227.     {
  228.         if (!$this->parameters->contains($parameter)) {
  229.             $this->parameters[] = $parameter;
  230.             $parameter->setWebPage($this);
  231.         }
  232.         return $this;
  233.     }
  234.     public function removeParameter(WebPageParameter $parameter) : self
  235.     {
  236.         if ($this->parameters->removeElement($parameter)) {
  237.             // set the owning side to null (unless already changed)
  238.             if ($parameter->getWebPage() === $this) {
  239.                 $parameter->setWebPage(null);
  240.             }
  241.         }
  242.         return $this;
  243.     }
  244. }