<?phpnamespace App\Entity;use App\Repository\LocationRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: LocationRepository::class)]class Location{ #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column(type: 'integer')] private $id; #[ORM\Column(type: 'string', length: 20)] private $type; #[ORM\Column(type: 'string', length: 255)] private $name; #[ORM\Column(type: 'string', length: 10)] private $acronym; #[ORM\Embedded(class: Address::class)] private $address; #[ORM\OneToMany(mappedBy: 'location', targetEntity: Slot::class)] private $slots; public function __construct() { $this->slots = new ArrayCollection(); } public function __toString(): string { return sprintf('%s %s (%s)', $this->getType(), $this->getName(), $this->getAcronym()); } public function getId(): ?int { return $this->id; } public function getType(): ?string { return $this->type; } public function setType(string $type): self { $this->type = $type; return $this; } public function getName(): ?string { return $this->name; } public function setName(string $name): self { $this->name = $name; return $this; } public function getAcronym(): ?string { return $this->acronym; } public function setAcronym(string $acronym): self { $this->acronym = $acronym; return $this; } public function getAddress(): ?Address { return $this->address; } public function setAddress(?Address $address): self { $this->address = $address; return $this; } /** * @return Collection<int, Slot> */ public function getSlots(): Collection { return $this->slots; } public function addSlot(Slot $slot): self { if (!$this->slots->contains($slot)) { $this->slots[] = $slot; $slot->setLocation($this); } return $this; } public function removeSlot(Slot $slot): self { if ($this->slots->removeElement($slot)) { // set the owning side to null (unless already changed) if ($slot->getLocation() === $this) { $slot->setLocation(null); } } return $this; }}