| Numéro du ticket | Titre du ticket | |------------------|-----------------| | #278 | Plan du site | ## Description de la PR [#278] Plan du site ## Modification du .env ## Check list - [ ] Pas de régression - [x] TU/TI/TF rédigée - [x] TU/TI/TF OK - [ ] CHANGELOG modifié Co-authored-by: Matteo <matteo@yuno.malio.fr> Reviewed-on: #33 Co-authored-by: tristan <tristan@yuno.malio.fr> Co-committed-by: tristan <tristan@yuno.malio.fr>
This commit was merged in pull request #33.
This commit is contained in:
@@ -11,6 +11,7 @@ use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Serializer\Attribute\Groups;
|
||||
use Symfony\Component\Serializer\Attribute\SerializedName;
|
||||
|
||||
#[ORM\Entity]
|
||||
#[ORM\Table(name: 'building')]
|
||||
@@ -48,9 +49,25 @@ class Building
|
||||
#[ORM\ManyToMany(targetEntity: Reception::class, mappedBy: 'buildings')]
|
||||
private Collection $receptions;
|
||||
|
||||
/**
|
||||
* @var Collection<int, BuildingCase>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: BuildingCase::class, mappedBy: 'id_building')]
|
||||
private Collection $buildingCases;
|
||||
|
||||
/**
|
||||
* @var Collection<int, BuildingLayout>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: BuildingLayout::class, mappedBy: 'id_building')]
|
||||
#[Groups(['building:read'])]
|
||||
#[SerializedName('layouts')]
|
||||
private Collection $buildingLayout;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->receptions = new ArrayCollection();
|
||||
$this->receptions = new ArrayCollection();
|
||||
$this->buildingCases = new ArrayCollection();
|
||||
$this->buildingLayout = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
@@ -89,4 +106,41 @@ class Building
|
||||
{
|
||||
return $this->receptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, BuildingCase>
|
||||
*/
|
||||
public function getBuildingCases(): Collection
|
||||
{
|
||||
return $this->buildingCases;
|
||||
}
|
||||
|
||||
public function addBuildingCase(BuildingCase $buildingCase): static
|
||||
{
|
||||
if (!$this->buildingCases->contains($buildingCase)) {
|
||||
$this->buildingCases->add($buildingCase);
|
||||
$buildingCase->setIdBuilding($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeBuildingCase(BuildingCase $buildingCase): static
|
||||
{
|
||||
if ($this->buildingCases->removeElement($buildingCase)) {
|
||||
if ($buildingCase->getIdBuilding() === $this) {
|
||||
$buildingCase->setIdBuilding(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, BuildingLayout>
|
||||
*/
|
||||
public function getBuildingLayout(): Collection
|
||||
{
|
||||
return $this->buildingLayout;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user