SddRegie.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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 SddRegie
  14. {
  15. #[ORM\Id]
  16. #[ORM\Column]
  17. #[ORM\GeneratedValue]
  18. private ?int $id = null;
  19. #[ORM\OneToMany(mappedBy: 'sddRegie',targetEntity: Bill::class, 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, Bill>
  31. */
  32. public function getBills(): Collection
  33. {
  34. return $this->bills;
  35. }
  36. public function addBill(Bill $bill): self
  37. {
  38. if (!$this->bills->contains($bill)) {
  39. $this->bills[] = $bill;
  40. $bill->setSddRegie($this);
  41. }
  42. return $this;
  43. }
  44. public function removeBill(Bill $bill): self
  45. {
  46. if ($this->bills->removeElement($bill)) {
  47. // set the owning side to null (unless already changed)
  48. if ($bill->getSddRegie() === $this) {
  49. $bill->setSddRegie(null);
  50. }
  51. }
  52. return $this;
  53. }
  54. }