<?phpnamespace App\Entity;use App\Repository\RankRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;/** * @ORM\Table(name="rank") * @ORM\Entity(repositoryClass=RankRepository::class) */class Rank{ /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255) */ private $name; /** * @ORM\OneToMany(targetEntity=Respondent::class, mappedBy="rank") */ private $respondents; /** * @ORM\OneToMany(targetEntity=TrainingRank::class, mappedBy="rank") */ private $trainingRanks; public function __construct() { $this->respondents = new ArrayCollection(); $this->trainingRanks = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getName(): ?string { return $this->name; } public function setName(string $name): self { $this->name = $name; return $this; } /** * @return Collection<int, Respondent> */ public function getRespondents(): Collection { return $this->respondents; } public function addRespondent(Respondent $respondent): self { if (!$this->respondents->contains($respondent)) { $this->respondents[] = $respondent; $respondent->setRank($this); } return $this; } public function removeRespondent(Respondent $respondent): self { if ($this->respondents->removeElement($respondent)) { // set the owning side to null (unless already changed) if ($respondent->getRank() === $this) { $respondent->setRank(null); } } return $this; } public function __toString(): string { return $this->name; } /** * @return Collection<int, TrainingRank> */ public function getTrainingRanks(): Collection { return $this->trainingRanks; } public function addTrainingRank(TrainingRank $trainingRank): self { if (!$this->trainingRanks->contains($trainingRank)) { $this->trainingRanks[] = $trainingRank; $trainingRank->setRank($this); } return $this; } public function removeTrainingRank(TrainingRank $trainingRank): self { if ($this->trainingRanks->removeElement($trainingRank)) { // set the owning side to null (unless already changed) if ($trainingRank->getRank() === $this) { $trainingRank->setRank(null); } } return $this; }}