FamilyQuotientBand.php 3.1 KB

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