<?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\SiteRepository")
*/
class Site
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @ORM\OneToMany(targetEntity=WebList::class, mappedBy="site", orphanRemoval=true)
*/
private $weblists;
/**
* @ORM\Column(type="string", length=255)
*/
private $url;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $cms;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $createdAt;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $updatedAt;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\User", inversedBy="sites")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="owner_id", referencedColumnName="id")
* })
*/
private $owner;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\DnsitEntity", inversedBy="sites")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="entity_id", referencedColumnName="id")
* })
*/
private $entity;
/**
* @ORM\Column(type="integer", nullable=true, options={"default":0, "comment":"code de statut : 0=OK"})
*/
private $state;
/**
* @ORM\OneToMany(targetEntity=WebSiteParameter::class, mappedBy="site", orphanRemoval=true, cascade={"persist", "remove"})
*/
private $parameters;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $adminMailAddress;
/**
* @var \Doctrine\Common\Collections\Collection
*
* @ORM\OneToMany(targetEntity="App\Entity\UsageStatistic", mappedBy="site", cascade={"persist"})
*/
private $usageStatistics;
public function __construct()
{
$this->weblists = new ArrayCollection();
$this->parameters = new ArrayCollection();
$this->usageStatistics = 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|WebList[]
*/
public function getWeblists() : Collection
{
return $this->weblists;
}
public function addWeblist(WebList $weblist) : self
{
if (!$this->weblists->contains($weblist)) {
$this->weblists[] = $weblist;
$weblist->setSite($this);
}
return $this;
}
public function removeWeblist(WebList $weblist) : self
{
if ($this->weblists->removeElement($weblist)) {
// set the owning side to null (unless already changed)
if ($weblist->getSite() === $this) {
$weblist->setSite(null);
}
}
return $this;
}
public function getUrl() : ?string
{
return $this->url;
}
public function setUrl(string $url) : self
{
$this->url = $url;
return $this;
}
public function getCms() : ?string
{
return $this->cms;
}
public function setCms(string $cms) : self
{
$this->cms = $cms;
return $this;
}
/**
* @return Collection|WebSiteParameter[]
*/
public function getParameters(): Collection
{
return $this->parameters;
}
public function addParameter(WebSiteParameter $parameter): self
{
if (!$this->parameters->contains($parameter)) {
$this->parameters[] = $parameter;
$parameter->setSite($this);
}
return $this;
}
public function removeParameter(WebSiteParameter $parameter): self
{
if ($this->parameters->removeElement($parameter)) {
// set the owning side to null (unless already changed)
if ($parameter->getSite() === $this) {
$parameter->setSite(null);
}
}
return $this;
}
public function getAdminMailAddress() : ?string
{
return $this->adminMailAddress;
}
public function setAdminMailAddress(string $adminMailAddress) : self
{
$this->adminMailAddress = $adminMailAddress;
return $this;
}
/**
* @return Collection|UsageStatistic[]
*/
public function getUsageStatistics(): Collection
{
return $this->usageStatistics;
}
public function addUsageStatistic(UsageStatistic $usageStatistic): self
{
if (!$this->usageStatistics->contains($usageStatistic)) {
$this->usageStatistics[] = $usageStatistic;
$usageStatistic->setSite($this);
}
return $this;
}
public function removeUsageStatistic(UsageStatistic $usageStatistic): self
{
if ($this->usageStatistics->contains($usageStatistic)) {
$this->usageStatistics->removeElement($usageStatistic);
// set the owning side to null (unless already changed)
if ($usageStatistic->getSite() === $this) {
$usageStatistic->setSite(null);
}
}
return $this;
}
}