Encartes-backend/src/Entity/PolySurface.php

76 lines
1.9 KiB
PHP

<?php
namespace App\Entity;
use App\Repository\PolySurfaceRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: PolySurfaceRepository::class)]
class PolySurface
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: "integer")]
private $id;
#[ORM\OneToMany(targetEntity: PlaneSurface::class, mappedBy: "polySurface")]
private $polysurfaceComponent;
#[ORM\ManyToOne(targetEntity: Place::class, inversedBy: "PolySurfaceRepresentation")]
private $place;
public function __construct()
{
$this->polysurfaceComponent = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
/**
* @return Collection<int, PlaneSurface>
*/
public function getPolysurfaceComponent(): Collection
{
return $this->polysurfaceComponent;
}
public function addPolysurfaceComponent(PlaneSurface $polysurfaceComponent): self
{
if (!$this->polysurfaceComponent->contains($polysurfaceComponent)) {
$this->polysurfaceComponent[] = $polysurfaceComponent;
$polysurfaceComponent->setPolySurface($this);
}
return $this;
}
public function removePolysurfaceComponent(PlaneSurface $polysurfaceComponent): self
{
if ($this->polysurfaceComponent->removeElement($polysurfaceComponent)) {
// set the owning side to null (unless already changed)
if ($polysurfaceComponent->getPolySurface() === $this) {
$polysurfaceComponent->setPolySurface(null);
}
}
return $this;
}
public function getPlace(): ?Place
{
return $this->place;
}
public function setPlace(?Place $place): self
{
$this->place = $place;
return $this;
}
}