Jvs.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. /** @var Collection<int, Bill> */
  20. #[ORM\OneToMany(targetEntity: Bill::class, mappedBy: 'jvs', cascade: ['persist'], orphanRemoval: true)]
  21. private Collection $bills;
  22. public function __construct()
  23. {
  24. $this->bills = new ArrayCollection();
  25. }
  26. public function getId(): ?int
  27. {
  28. return $this->id;
  29. }
  30. /**
  31. * @return Collection<int, Bill>
  32. */
  33. public function getBills(): Collection
  34. {
  35. return $this->bills;
  36. }
  37. public function addBill(Bill $bill): self
  38. {
  39. if (!$this->bills->contains($bill)) {
  40. $this->bills[] = $bill;
  41. $bill->setJvs($this);
  42. }
  43. return $this;
  44. }
  45. public function removeBill(Bill $bill): self
  46. {
  47. if ($this->bills->removeElement($bill)) {
  48. // set the owning side to null (unless already changed)
  49. if ($bill->getJvs() === $this) {
  50. $bill->setJvs(null);
  51. }
  52. }
  53. return $this;
  54. }
  55. }