| 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:
141
src/Entity/BuildingLayout.php
Normal file
141
src/Entity/BuildingLayout.php
Normal file
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\BuildingLayoutRepository;
|
||||
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(repositoryClass: BuildingLayoutRepository::class)]
|
||||
class BuildingLayout
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
#[Groups(['building:read'])]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
#[Groups(['building:read'])]
|
||||
private ?string $name = null;
|
||||
|
||||
#[ORM\Column]
|
||||
#[Groups(['building:read'])]
|
||||
private ?int $columns = null;
|
||||
|
||||
#[ORM\Column]
|
||||
#[Groups(['building:read'])]
|
||||
private ?int $rows = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'buildingLayout')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?Building $id_building = null;
|
||||
|
||||
/**
|
||||
* @var Collection<int, BuildingCasePosition>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: BuildingCasePosition::class, mappedBy: 'buildingLayout')]
|
||||
#[Groups(['building:read'])]
|
||||
#[SerializedName('casePositions')]
|
||||
private Collection $id_case_position;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->id_case_position = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setId(int $id): static
|
||||
{
|
||||
$this->id = $id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getName(): ?string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function setName(string $name): static
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getColumns(): ?int
|
||||
{
|
||||
return $this->columns;
|
||||
}
|
||||
|
||||
public function setColumns(int $columns): static
|
||||
{
|
||||
$this->columns = $columns;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getRows(): ?int
|
||||
{
|
||||
return $this->rows;
|
||||
}
|
||||
|
||||
public function setRows(int $rows): static
|
||||
{
|
||||
$this->rows = $rows;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getIdBuilding(): ?Building
|
||||
{
|
||||
return $this->id_building;
|
||||
}
|
||||
|
||||
public function setIdBuilding(?Building $id_building): static
|
||||
{
|
||||
$this->id_building = $id_building;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, BuildingCasePosition>
|
||||
*/
|
||||
public function getIdCasePosition(): Collection
|
||||
{
|
||||
return $this->id_case_position;
|
||||
}
|
||||
|
||||
public function addIdCasePosition(BuildingCasePosition $idCasePosition): static
|
||||
{
|
||||
if (!$this->id_case_position->contains($idCasePosition)) {
|
||||
$this->id_case_position->add($idCasePosition);
|
||||
$idCasePosition->setBuildingLayout($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeIdCasePosition(BuildingCasePosition $idCasePosition): static
|
||||
{
|
||||
if ($this->id_case_position->removeElement($idCasePosition)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($idCasePosition->getBuildingLayout() === $this) {
|
||||
$idCasePosition->setBuildingLayout(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user