FamilyQuotientModel.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Entity\Billing;
  4. use ApiPlatform\Metadata\ApiResource;
  5. use App\Entity\Organization\Organization;
  6. use App\Entity\Product\IntangiblePriceAndDiscount;
  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 FamilyQuotientModel
  15. {
  16. #[ORM\Id]
  17. #[ORM\Column]
  18. #[ORM\GeneratedValue]
  19. private int $id;
  20. #[ORM\ManyToOne(targetEntity: Organization::class, cascade: [], inversedBy: 'familyQuotientModels')]
  21. #[ORM\JoinColumn(nullable: false)]
  22. protected Organization $organization;
  23. /** @var Collection<int, FamilyQuotientBand> */
  24. #[ORM\OneToMany(targetEntity: FamilyQuotientBand::class, mappedBy: 'familyQuotientModel', cascade: ['persist'], orphanRemoval: true)]
  25. protected Collection $familyQuotientBands;
  26. /** @var Collection<int, IntangiblePriceAndDiscount> */
  27. #[ORM\OneToMany(targetEntity: IntangiblePriceAndDiscount::class, mappedBy: 'familyQuotientModel', cascade: [], orphanRemoval: false)]
  28. protected Collection $intangiblePriceAndDiscounts;
  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 getOrganization(): Organization
  39. {
  40. return $this->organization;
  41. }
  42. public function setOrganization(Organization $organization): self
  43. {
  44. $this->organization = $organization;
  45. return $this;
  46. }
  47. public function getFamilyQuotientBands(): Collection
  48. {
  49. return $this->familyQuotientBands;
  50. }
  51. public function addFamilyQuotientBand(FamilyQuotientBand $familyQuotientBand): self
  52. {
  53. if (!$this->familyQuotientBands->contains($familyQuotientBand)) {
  54. $this->familyQuotientBands[] = $familyQuotientBand;
  55. $familyQuotientBand->setFamilyQuotientModel($this);
  56. }
  57. return $this;
  58. }
  59. public function removeFamilyQuotientBand(FamilyQuotientBand $familyQuotientBand): self
  60. {
  61. if ($this->familyQuotientBands->removeElement($familyQuotientBand)) {
  62. $familyQuotientBand->setFamilyQuotientModel(null);
  63. }
  64. return $this;
  65. }
  66. public function getIntangiblePriceAndDiscounts(): Collection
  67. {
  68. return $this->intangiblePriceAndDiscounts;
  69. }
  70. public function addIntangiblePriceAndDiscount(IntangiblePriceAndDiscount $intangiblePriceAndDiscount): self
  71. {
  72. if (!$this->intangiblePriceAndDiscounts->contains($intangiblePriceAndDiscount)) {
  73. $this->intangiblePriceAndDiscounts[] = $intangiblePriceAndDiscount;
  74. $intangiblePriceAndDiscount->setFamilyQuotientModel($this);
  75. }
  76. return $this;
  77. }
  78. public function removeIntangiblePriceAndDiscount(IntangiblePriceAndDiscount $intangiblePriceAndDiscount): self
  79. {
  80. if ($this->intangiblePriceAndDiscounts->removeElement($intangiblePriceAndDiscount)) {
  81. $intangiblePriceAndDiscount->setFamilyQuotientModel(null);
  82. }
  83. return $this;
  84. }
  85. }