<?php
namespace App\Entity;
use App\Repository\OpslaglocatieRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: OpslaglocatieRepository::class)]
class Opslaglocatie
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $naam = null;
#[ORM\OneToMany(mappedBy: 'opslaglocatie', targetEntity: Orderonderdeel::class)]
private Collection $orderonderdelen;
public function __construct()
{
$this->orderonderdelen = new ArrayCollection();
}
public function __toString()
{
return $this->getNaam();
}
public function getId(): ?int
{
return $this->id;
}
public function getNaam(): ?string
{
return $this->naam;
}
public function setNaam(string $naam): static
{
$this->naam = $naam;
return $this;
}
/**
* @return Collection<int, Orderonderdeel>
*/
public function getOrderonderdelen(): Collection
{
return $this->orderonderdelen;
}
public function addOrderonderdelen(Orderonderdeel $orderonderdelen): static
{
if (!$this->orderonderdelen->contains($orderonderdelen)) {
$this->orderonderdelen->add($orderonderdelen);
$orderonderdelen->setOpslaglocatie($this);
}
return $this;
}
public function removeOrderonderdelen(Orderonderdeel $orderonderdelen): static
{
if ($this->orderonderdelen->removeElement($orderonderdelen)) {
// set the owning side to null (unless already changed)
if ($orderonderdelen->getOpslaglocatie() === $this) {
$orderonderdelen->setOpslaglocatie(null);
}
}
return $this;
}
}