<?php
namespace App\Entity;
use App\Repository\VotingBoothRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=VotingBoothRepository::class)
*/
class VotingBooth
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $number;
/**
* @ORM\OneToMany(targetEntity=Person::class, mappedBy="vBooth")
*/
private $persons;
public function __construct()
{
$this->persons = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getNumber(): ?string
{
return $this->number;
}
public function setNumber(string $number): self
{
$this->number = $number;
return $this;
}
/**
* @return Collection<int, Person>
*/
public function getPersons(): Collection
{
return $this->persons;
}
public function addPerson(Person $person): self
{
if (!$this->persons->contains($person)) {
$this->persons[] = $person;
$person->setVBooth($this);
}
return $this;
}
public function removePerson(Person $person): self
{
if ($this->persons->removeElement($person)) {
// set the owning side to null (unless already changed)
if ($person->getVBooth() === $this) {
$person->setVBooth(null);
}
}
return $this;
}
}