Jvs.php 1.7 KB

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