<?php
namespace App\Entity;
use App\Repository\BegraafplaatsRepository;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: BegraafplaatsRepository::class)]
class Begraafplaats
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $naam = null;
#[ORM\Column(length: 25)]
private ?string $codenaam = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $adres = null;
#[ORM\Column(length: 15, nullable: true)]
private ?string $postcode = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $plaats = null;
#[ORM\OneToMany(mappedBy: 'begraafplaats', targetEntity: Order::class)]
private Collection $orders;
public function __toString(): string
{
$parts = array($this->getNaam(),$this->getPlaats());
return implode(", ",$parts);
}
public function getId(): ?int
{
return $this->id;
}
public function getNaam(): ?string
{
return $this->naam;
}
public function setNaam(string $naam): self
{
$this->naam = $naam;
return $this;
}
public function getCodenaam(): ?string
{
return $this->codenaam;
}
public function setCodenaam(string $codenaam): self
{
$this->codenaam = $codenaam;
return $this;
}
public function getAdres(): ?string
{
return $this->adres;
}
public function setAdres(?string $adres): self
{
$this->adres = $adres;
return $this;
}
public function getPostcode(): ?string
{
return $this->postcode;
}
public function setPostcode(?string $postcode): self
{
$this->postcode = $postcode;
return $this;
}
public function getPlaats(): ?string
{
return $this->plaats;
}
public function setPlaats(?string $plaats): self
{
$this->plaats = $plaats;
return $this;
}
/**
* @return Collection<int, Order>
*/
public function getOrders(): Collection
{
return $this->orders;
}
public function addOrder(Order $order): self
{
if (!$this->orders->contains($order)) {
$this->orders->add($order);
$order->setBegraafplaats($this);
}
return $this;
}
public function removeOrder(Order $order): self
{
if ($this->orders->removeElement($order)) {
// set the owning side to null (unless already changed)
if ($order->getBegraafplaats() === $this) {
$order->setBegraafplaats(null);
}
}
return $this;
}
}