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