mirror of
https://gitlab.aliens-lyon.fr/encartes/backend.git
synced 2026-09-11 16:50:46 +02:00
Création de la base de donnée (du moins, des scripts pour la base de donnée)
This commit is contained in:
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\SiteRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* @ORM\Entity(repositoryClass=SiteRepository::class)
|
||||
*/
|
||||
class Site
|
||||
{
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="float")
|
||||
*/
|
||||
private $zeroLatitude;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="float")
|
||||
*/
|
||||
private $zeroLongitude;
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity=Building::class, mappedBy="site")
|
||||
*/
|
||||
private $buildings;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->buildings = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getZeroLatitude(): ?float
|
||||
{
|
||||
return $this->zeroLatitude;
|
||||
}
|
||||
|
||||
public function setZeroLatitude(float $zeroLatitude): self
|
||||
{
|
||||
$this->zeroLatitude = $zeroLatitude;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getZeroLongitude(): ?float
|
||||
{
|
||||
return $this->zeroLongitude;
|
||||
}
|
||||
|
||||
public function setZeroLongitude(float $zeroLongitude): self
|
||||
{
|
||||
$this->zeroLongitude = $zeroLongitude;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Building>
|
||||
*/
|
||||
public function getBuildings(): Collection
|
||||
{
|
||||
return $this->buildings;
|
||||
}
|
||||
|
||||
public function addBuilding(Building $building): self
|
||||
{
|
||||
if (!$this->buildings->contains($building)) {
|
||||
$this->buildings[] = $building;
|
||||
$building->setSite($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeBuilding(Building $building): self
|
||||
{
|
||||
if ($this->buildings->removeElement($building)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($building->getSite() === $this) {
|
||||
$building->setSite(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user