suivi/src/Entity/BillVendor.php
2023-04-08 17:47:43 +02:00

82 lines
1.7 KiB
PHP

<?php
namespace App\Entity;
use App\Repository\BillVendorRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use App\Core\Entity\EntityInterface;
#[ORM\Entity(repositoryClass: BillVendorRepository::class)]
class BillVendor implements EntityInterface
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $label = null;
#[ORM\OneToMany(mappedBy: 'vendor', targetEntity: Bill::class)]
private Collection $bills;
public function __construct()
{
$this->bills = new ArrayCollection();
}
public function __toString()
{
return (string) $this->getLabel();
}
public function getId(): ?int
{
return $this->id;
}
public function getLabel(): ?string
{
return $this->label;
}
public function setLabel(string $label): self
{
$this->label = $label;
return $this;
}
/**
* @return Collection<int, Bill>
*/
public function getBills(): Collection
{
return $this->bills;
}
public function addBill(Bill $bill): self
{
if (!$this->bills->contains($bill)) {
$this->bills->add($bill);
$bill->setVendor($this);
}
return $this;
}
public function removeBill(Bill $bill): self
{
if ($this->bills->removeElement($bill)) {
// set the owning side to null (unless already changed)
if ($bill->getVendor() === $this) {
$bill->setVendor(null);
}
}
return $this;
}
}