src/Entity/Site/Site.php line 21

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Site;
  3. use App\Entity\Federation\Race;
  4. use App\Entity\Federation\Team;
  5. use App\Entity\Media\DocumentType;
  6. use Gedmo\Mapping\Annotation as Gedmo;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. use Doctrine\Common\Collections\Collection;
  9. use Doctrine\ORM\Mapping as ORM;
  10. use Symfony\Component\Validator\Constraints as Assert;
  11. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  12. use App\Entity\User\Alert;
  13. /**
  14.  * @ORM\Entity(repositoryClass="App\Repository\Site\SiteRepository")
  15.  * @ORM\Table(name="sites")
  16.  * @UniqueEntity("name")
  17.  */
  18. class Site
  19. {
  20.     /**
  21.      * @ORM\Id
  22.      * @ORM\Column(type="integer")
  23.      * @ORM\GeneratedValue(strategy="AUTO")
  24.      */
  25.     private $id;
  26.     
  27.     /**
  28.      * @Gedmo\Slug(fields={"name"})
  29.      * @ORM\Column(length=255, unique=true)
  30.      */
  31.     private $url;
  32.   
  33.     /**
  34.      * @ORM\Column(type="string", length=255, nullable=true)
  35.      * @Assert\NotBlank()
  36.      */
  37.     private $domain;
  38.     /**
  39.      * @ORM\Column(type="string", length=255, nullable=true)
  40.      * @Assert\NotBlank()
  41.      */
  42.     private $email;
  43.     /**
  44.      * @ORM\Column(type="string", length=255, nullable=true)
  45.      * @Assert\NotBlank()
  46.      */
  47.     private $name;
  48.     /**
  49.      * @ORM\Column(type="text", nullable=true)
  50.      */
  51.     private $favicon;
  52.     /**
  53.      * @ORM\Column(type="text", nullable=true)
  54.      */
  55.     private $logo;
  56.     /**
  57.      * @ORM\Column(type="text", nullable=true)
  58.      */
  59.     private $cover;
  60.     /**
  61.      * @ORM\Column(type="string", length=255, nullable=true)
  62.      */
  63.     private $firstColor;
  64.     /**
  65.      * @ORM\Column(type="string", length=255, nullable=true)
  66.      */
  67.     private $secondColor;
  68.     
  69.     /**
  70.      * @ORM\Column(type="datetime", nullable=true)
  71.      * @Assert\NotBlank()
  72.      */
  73.     private $startDate;
  74.     
  75.     /**
  76.      * @ORM\Column(type="datetime", nullable=true)
  77.      * @Assert\NotBlank()
  78.      */
  79.     private $endDate;
  80.     
  81.     /**
  82.      * @ORM\Column(type="datetime", nullable=false, name="created_date")
  83.      * @Gedmo\Timestampable(on="create")
  84.      */
  85.     private $createdDate;
  86.     /**
  87.      * @ORM\Column(type="datetime", nullable=true, name="updated_date")
  88.      * @Gedmo\Timestampable(on="update")
  89.      */
  90.     private $updatedDate;
  91.     /**
  92.      * @ORM\Column(type="integer", nullable=false, name="status")
  93.      */
  94.     private $status 1;
  95.     /**
  96.      * @ORM\OneToMany(targetEntity="App\Entity\Site\AccessSite", mappedBy="site", cascade={"remove"})
  97.      */
  98.     private $accessSites;
  99.     /**
  100.      * @ORM\ManyToOne(targetEntity="App\Entity\Federation\Race", inversedBy="sites")
  101.      * @ORM\JoinColumn(name="race_id", referencedColumnName="id")
  102.      */
  103.     private $race;
  104.     /**
  105.      * @ORM\ManyToOne(targetEntity="App\Entity\Federation\Team", inversedBy="sites")
  106.      * @ORM\JoinColumn(name="team_id", referencedColumnName="id")
  107.      */
  108.     private $team;
  109.     /**
  110.      * @ORM\OneToMany(targetEntity="App\Entity\User\Alert", mappedBy="site", cascade={"remove"})
  111.      */
  112.     private $alerts;
  113.     /**
  114.      * @var array
  115.      *
  116.      * @ORM\Column(name="notification_settings", type="json", nullable=true)
  117.      */
  118.     private $notificationSettings = [];
  119.     public function __construct()
  120.     {
  121.         $this->accessSites = new ArrayCollection();
  122.         $this->alerts = new ArrayCollection();
  123.     }
  124.     public function getId(): ?int
  125.     {
  126.         return $this->id;
  127.     }
  128.     
  129.     public function getUrl(): ?string
  130.     {
  131.         return $this->url;
  132.     }
  133.     public function getDomain(): ?string
  134.     {
  135.         return $this->domain;
  136.     }
  137.     public function setDomain(?string $domain): self
  138.     {
  139.         $this->domain $domain;
  140.         return $this;
  141.     }
  142.     public function getEmail(): ?string
  143.     {
  144.         return $this->email;
  145.     }
  146.     public function setEmail(?string $email): self
  147.     {
  148.         $this->email $email;
  149.         return $this;
  150.     }
  151.     public function getName(): ?string
  152.     {
  153.         return $this->name;
  154.     }
  155.     public function setName(?string $name): self
  156.     {
  157.         $this->name $name;
  158.         return $this;
  159.     }
  160.     public function getFavicon(): ?string
  161.     {
  162.         return $this->favicon;
  163.     }
  164.     public function setFavicon(?string $favicon): self
  165.     {
  166.         $this->favicon $favicon;
  167.         return $this;
  168.     }
  169.     public function getLogo(): ?string
  170.     {
  171.         return $this->logo;
  172.     }
  173.     public function setLogo(?string $logo): self
  174.     {
  175.         $this->logo $logo;
  176.         return $this;
  177.     }
  178.     public function getCover(): ?string
  179.     {
  180.         return $this->cover;
  181.     }
  182.     public function setCover(?string $cover): self
  183.     {
  184.         $this->cover $cover;
  185.         return $this;
  186.     }
  187.     public function getFirstColor(): ?string
  188.     {
  189.         return $this->firstColor;
  190.     }
  191.     public function setFirstColor(?string $firstColor): self
  192.     {
  193.         $this->firstColor $firstColor;
  194.         return $this;
  195.     }
  196.     public function getSecondColor(): ?string
  197.     {
  198.         return $this->secondColor;
  199.     }
  200.     public function setSecondColor(?string $secondColor): self
  201.     {
  202.         $this->secondColor $secondColor;
  203.         return $this;
  204.     }
  205.     public function getCreatedDate(): ?\DateTimeInterface
  206.     {
  207.         return $this->createdDate;
  208.     }    
  209.     public function getUpdatedDate(): ?\DateTimeInterface
  210.     {
  211.         return $this->updatedDate;
  212.     }
  213.     
  214.     public function getStartDate(): ?\DateTimeInterface
  215.     {
  216.         return $this->startDate;
  217.     }
  218.     
  219.     public function setStartDate(?\DateTimeInterface $startDate): self
  220.     {
  221.         $this->startDate $startDate;
  222.         
  223.         return $this;
  224.     }
  225.     
  226.     public function getEndDate(): ?\DateTimeInterface
  227.     {
  228.         return $this->endDate;
  229.     }
  230.     
  231.     public function setEndDate(?\DateTimeInterface $endDate): self
  232.     {
  233.         $this->endDate $endDate;
  234.         
  235.         return $this;
  236.     }
  237.     public function getStatus(): ?int
  238.     {
  239.         return $this->status;
  240.     }
  241.     public function setStatus(int $status): self
  242.     {
  243.         $this->status $status;
  244.         return $this;
  245.     }
  246.     /**
  247.      * @return Collection|AccessSite[]
  248.      */
  249.     public function getAccessSites(): Collection
  250.     {
  251.         return $this->accessSites;
  252.     }
  253.     public function addAccessSite(AccessSite $accessSite): self
  254.     {
  255.         if (!$this->accessSites->contains($accessSite)) {
  256.             $this->accessSites[] = $accessSite;
  257.             $accessSite->setSite($this);
  258.         }
  259.         return $this;
  260.     }
  261.     public function removeAccessSite(AccessSite $accessSite): self
  262.     {
  263.         if ($this->accessSites->contains($accessSite)) {
  264.             $this->accessSites->removeElement($accessSite);
  265.             // set the owning side to null (unless already changed)
  266.             if ($accessSite->getSite() === $this) {
  267.                 $accessSite->setSite(null);
  268.             }
  269.         }
  270.         return $this;
  271.     }
  272.     /**
  273.      * @return Collection|Alert[]
  274.      */
  275.     public function getAlerts(): Collection
  276.     {
  277.         return $this->alerts;
  278.     }
  279.     public function addAlert(Alert $alert): self
  280.     {
  281.         if (!$this->alerts->contains($alert)) {
  282.             $this->alerts[] = $alert;
  283.         }
  284.         return $this;
  285.     }
  286.     public function removeAlert(Alert $alert): self
  287.     {
  288.         if ($this->alerts->contains($alert)) {
  289.             $this->alerts->removeElement($alert);
  290.         }
  291.         return $this;
  292.     }
  293.     public function getRace(): ?Race
  294.     {
  295.         return $this->race;
  296.     }
  297.     public function setRace(?Race $race): self
  298.     {
  299.         $this->race $race;
  300.         return $this;
  301.     }
  302.     public function getTeam(): ?Team
  303.     {
  304.         return $this->team;
  305.     }
  306.     public function setTeam(?Team $team): self
  307.     {
  308.         $this->team $team;
  309.         return $this;
  310.     }
  311.     public function getNotificationSettings(): array
  312.     {
  313.         return $this->notificationSettings;
  314.     }
  315.     public function setNotificationSettings(array $notificationSettings): void
  316.     {
  317.         $this->notificationSettings $notificationSettings;
  318.     }
  319.     public function __toString(): string
  320.     {
  321.         return $this->name;
  322.     }
  323. }