BillingExportSetting.php 2.2 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\Access\Access;
  7. use App\Entity\Organization\Organization;
  8. use Doctrine\Common\Collections\ArrayCollection;
  9. use Doctrine\Common\Collections\Collection;
  10. use Doctrine\ORM\Mapping as ORM;
  11. /**
  12. * Paramètres généraux des exports de factures (Bill).
  13. */
  14. // #[Auditable]
  15. #[ApiResource(operations: [])]
  16. #[ORM\Entity]
  17. class BillingExportSetting
  18. {
  19. #[ORM\Id]
  20. #[ORM\Column]
  21. #[ORM\GeneratedValue]
  22. private ?int $id = null;
  23. #[ORM\ManyToOne]
  24. #[ORM\JoinColumn(nullable: true)]
  25. private ?SddTeneur $teneur = null;
  26. #[ORM\OneToOne(targetEntity: Organization::class, inversedBy: 'billingExportSetting', cascade: [])]
  27. protected ?Organization $organization;
  28. /** @var Collection<int, Access> */
  29. #[ORM\ManyToMany(targetEntity: Access::class, cascade: [], orphanRemoval: false)]
  30. protected Collection $stageManagers;
  31. public function __construct()
  32. {
  33. $this->stageManagers = new ArrayCollection();
  34. }
  35. public function getId(): ?int
  36. {
  37. return $this->id;
  38. }
  39. public function getTeneur(): ?SddTeneur
  40. {
  41. return $this->teneur;
  42. }
  43. public function setTeneur(?SddTeneur $teneur): self
  44. {
  45. $this->teneur = $teneur;
  46. return $this;
  47. }
  48. public function getOrganization(): ?Organization
  49. {
  50. return $this->organization;
  51. }
  52. public function setOrganization(?Organization $organization): self
  53. {
  54. $this->organization = $organization;
  55. return $this;
  56. }
  57. public function getStageManagers(): Collection
  58. {
  59. return $this->stageManagers;
  60. }
  61. public function addStageManager(Access $stageManager): self
  62. {
  63. if (!$this->stageManagers->contains($stageManager)) {
  64. $this->stageManagers[] = $stageManager;
  65. // TODO: compléter (je n'ai pas le mappedBy)
  66. }
  67. return $this;
  68. }
  69. public function removeStageManager(Access $stageManager): self
  70. {
  71. $this->stageManagers->removeElement($stageManager);
  72. // TODO: compléter (je n'ai pas le mappedBy)
  73. return $this;
  74. }
  75. }