<?php
namespace App\Entity;
use App\Repository\SiteRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* @ORM\Entity(repositoryClass=SiteRepository::class)
*/
class Site
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $title;
/**
* @ORM\Column(type="string", length=255)
*/
private $description;
/**
* @ORM\Column(type="text")
*/
private $detailed_description;
/**
* @ORM\Column(type="float")
*/
private $latitude;
/**
* @ORM\Column(type="float")
*/
private $longitude;
/**
* @ORM\Column(type="string", length=255)
*/
private $image;
/**
* @ORM\ManyToOne(targetEntity=SiteCategory::class, inversedBy="sites")
*/
private $siteCategory;
/**
* @ORM\Column(type="datetime_immutable")
* @Gedmo\Timestampable(on="create")
*/
private $created_at;
/**
* @ORM\Column(type="datetime_immutable")
* @Gedmo\Timestampable(on="update")
*/
private $updated_at;
/**
* @ORM\OneToMany(targetEntity=CircuitSite::class, mappedBy="site")
*/
private $circuitSites;
public function __construct()
{
$this->circuitSites = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(string $title): self
{
$this->title = $title;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(string $description): self
{
$this->description = $description;
return $this;
}
public function getDetailedDescription(): ?string
{
return $this->detailed_description;
}
public function setDetailedDescription(string $detailed_description): self
{
$this->detailed_description = $detailed_description;
return $this;
}
public function getLatitude(): ?float
{
return $this->latitude;
}
public function setLatitude(float $latitude): self
{
$this->latitude = $latitude;
return $this;
}
public function getLongitude(): ?float
{
return $this->longitude;
}
public function setLongitude(float $longitude): self
{
$this->longitude = $longitude;
return $this;
}
public function getImage(): ?string
{
return $this->image;
}
public function setImage(string $image): self
{
$this->image = $image;
return $this;
}
public function getSiteCategory(): ?SiteCategory
{
return $this->siteCategory;
}
public function setSiteCategory(?SiteCategory $siteCategory): self
{
$this->siteCategory = $siteCategory;
return $this;
}
public function getCreatedAt(): ?\DateTimeImmutable
{
return $this->created_at;
}
public function setCreatedAt(\DateTimeImmutable $created_at): self
{
$this->created_at = $created_at;
return $this;
}
public function getUpdatedAt(): ?\DateTimeImmutable
{
return $this->updated_at;
}
public function setUpdatedAt(\DateTimeImmutable $updated_at): self
{
$this->updated_at = $updated_at;
return $this;
}
/**
* @return Collection<int, CircuitSite>
*/
public function getCircuitSites(): Collection
{
return $this->circuitSites;
}
public function addCircuitSite(CircuitSite $circuitSite): self
{
if (!$this->circuitSites->contains($circuitSite)) {
$this->circuitSites[] = $circuitSite;
$circuitSite->setSite($this);
}
return $this;
}
public function removeCircuitSite(CircuitSite $circuitSite): self
{
if ($this->circuitSites->removeElement($circuitSite)) {
// set the owning side to null (unless already changed)
if ($circuitSite->getSite() === $this) {
$circuitSite->setSite(null);
}
}
return $this;
}
}