SddRegie.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Entity\Billing;
  4. // use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
  5. use ApiPlatform\Metadata\ApiResource;
  6. use App\Entity\Core\File;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. use Doctrine\Common\Collections\Collection;
  9. use Doctrine\ORM\Mapping as ORM;
  10. /**
  11. * TODO: documenter
  12. * // TODO: possible factoriser avec SddBank?
  13. */
  14. // #[Auditable]
  15. #[ApiResource(operations: [])]
  16. #[ORM\Entity]
  17. class SddRegie
  18. {
  19. #[ORM\Id]
  20. #[ORM\Column]
  21. #[ORM\GeneratedValue]
  22. private ?int $id = null;
  23. /** @var Collection<int, BillPayment> */
  24. #[ORM\OneToMany(mappedBy: 'sddRegime', targetEntity: BillPayment::class, cascade: [], orphanRemoval: false)]
  25. protected Collection $billPayments;
  26. #[ORM\OneToOne(targetEntity: File::class, cascade: ['persist'])]
  27. protected ?File $file;
  28. #[ORM\OneToOne(targetEntity: File::class, cascade: ['persist'])]
  29. protected ?File $bordereau;
  30. public function __construct()
  31. {
  32. $this->billPayments = new ArrayCollection();
  33. }
  34. public function getId(): ?int
  35. {
  36. return $this->id;
  37. }
  38. public function getBillPayments(): Collection
  39. {
  40. return $this->billPayments;
  41. }
  42. public function addBillPayment(BillPayment $billPayment): self
  43. {
  44. if (!$this->billPayments->contains($billPayment)) {
  45. $this->billPayments[] = $billPayment;
  46. $billPayment->setSddRegie($this);
  47. }
  48. return $this;
  49. }
  50. public function removeBillPayment(BillPayment $billPayment): self
  51. {
  52. if ($this->billPayments->removeElement($billPayment)) {
  53. // $billPayment->setSddBank(null); // TODO: actuellement, pas nullable: conserver?
  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. public function getBordereau(): ?File
  67. {
  68. return $this->bordereau;
  69. }
  70. public function setBordereau(?File $bordereau): self
  71. {
  72. $this->bordereau = $bordereau;
  73. return $this;
  74. }
  75. }