FamilyQuotientBand.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Entity\Billing;
  4. use ApiPlatform\Metadata\ApiResource;
  5. use App\Entity\Product\IntangibleDiscountDetail;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. /**
  9. * TODO: documenter.
  10. */
  11. #[ApiResource(operations: [])]
  12. #[ORM\Entity]
  13. class FamilyQuotientBand
  14. {
  15. #[ORM\Id]
  16. #[ORM\Column]
  17. #[ORM\GeneratedValue]
  18. private int $id;
  19. #[ORM\ManyToOne(targetEntity: FamilyQuotientModel::class, cascade: [], inversedBy: 'familyQuotientBands')]
  20. #[ORM\JoinColumn(nullable: false)]
  21. protected mixed $familyQuotientModel;
  22. /** @var Collection<int, FamilyQuotientBandDetail> */
  23. // #[ORM\Column(type: 'string')] // TODO: pourquoi c'est là ça?
  24. #[ORM\OneToMany(targetEntity: FamilyQuotientBandDetail::class, mappedBy: 'familyQuotientBand', cascade: ['persist'], orphanRemoval: true)]
  25. protected Collection $familyQuotientBandDetails;
  26. /** @var Collection<int, IntangibleDiscountDetail> */
  27. #[ORM\OneToMany(targetEntity: IntangibleDiscountDetail::class, mappedBy: 'familyQuotientBand', cascade: [], orphanRemoval: true)]
  28. protected Collection $intangibleDiscountDetails;
  29. public function getId(): int
  30. {
  31. return $this->id;
  32. }
  33. public function setId(int $id): self
  34. {
  35. $this->id = $id;
  36. return $this;
  37. }
  38. public function getFamilyQuotientModel(): mixed
  39. {
  40. return $this->familyQuotientModel;
  41. }
  42. public function setFamilyQuotientModel(mixed $familyQuotientModel): self
  43. {
  44. $this->familyQuotientModel = $familyQuotientModel;
  45. return $this;
  46. }
  47. public function getFamilyQuotientBandDetails(): Collection
  48. {
  49. return $this->familyQuotientBandDetails;
  50. }
  51. public function addFamilyQuotientBandDetail(FamilyQuotientBandDetail $familyQuotientBandDetail): self
  52. {
  53. if (!$this->familyQuotientBandDetails->contains($familyQuotientBandDetail)) {
  54. $this->familyQuotientBandDetails[] = $familyQuotientBandDetail;
  55. $familyQuotientBandDetail->setFamilyQuotientBand($this);
  56. }
  57. return $this;
  58. }
  59. public function removeFamilyQuotientBandDetail(FamilyQuotientBandDetail $familyQuotientBandDetail): self
  60. {
  61. if ($this->familyQuotientBandDetails->removeElement($familyQuotientBandDetail)) {
  62. $familyQuotientBandDetail->setFamilyQuotientBand(null);
  63. }
  64. return $this;
  65. }
  66. public function getIntangibleDiscountDetails(): Collection
  67. {
  68. return $this->intangibleDiscountDetails;
  69. }
  70. public function addIntangibleDiscountDetail(IntangibleDiscountDetail $intangibleDiscountDetail): self
  71. {
  72. if (!$this->intangibleDiscountDetails->contains($intangibleDiscountDetail)) {
  73. $this->intangibleDiscountDetails[] = $intangibleDiscountDetail;
  74. $intangibleDiscountDetail->setFamilyQuotientBand($this);
  75. }
  76. return $this;
  77. }
  78. public function removeIntangibleDiscountDetail(IntangibleDiscountDetail $intangibleDiscountDetail): self
  79. {
  80. $this->intangibleDiscountDetails->removeElement($intangibleDiscountDetail);
  81. return $this;
  82. }
  83. }