688fdd49ee
add webdav client change pdf viewer
86 lines
1.8 KiB
PHP
86 lines
1.8 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;
|
|
use App\Core\Doctrine\Timestampable;
|
|
|
|
#[ORM\Entity(repositoryClass: BillVendorRepository::class)]
|
|
#[ORM\HasLifecycleCallbacks]
|
|
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;
|
|
|
|
use Timestampable;
|
|
|
|
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;
|
|
}
|
|
}
|