Jvs.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Entity\Billing;
  4. // use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. /**
  9. * Classe ... qui ...
  10. */
  11. // #[Auditable]
  12. #[ORM\Entity]
  13. class Jvs
  14. {
  15. #[ORM\Id]
  16. #[ORM\Column]
  17. #[ORM\GeneratedValue]
  18. private ?int $id = null;
  19. #[ORM\OneToMany(mappedBy: 'jvs', targetEntity: AbstractBill::class, cascade: ['persist'], orphanRemoval: true)]
  20. private Collection $bills;
  21. public function __construct()
  22. {
  23. $this->bills = new ArrayCollection();
  24. }
  25. public function getId(): ?int
  26. {
  27. return $this->id;
  28. }
  29. /**
  30. * @return Collection<int, AbstractBill>
  31. */
  32. public function getBills(): Collection
  33. {
  34. return $this->bills;
  35. }
  36. public function addBill(AbstractBill $bill): self
  37. {
  38. if (!$this->bills->contains($bill)) {
  39. $this->bills[] = $bill;
  40. $bill->setJvs($this);
  41. }
  42. return $this;
  43. }
  44. public function removeBill(AbstractBill $bill): self
  45. {
  46. if ($this->bills->removeElement($bill)) {
  47. // set the owning side to null (unless already changed)
  48. if ($bill->getJvs() === $this) {
  49. $bill->setJvs(null);
  50. }
  51. }
  52. return $this;
  53. }
  54. }