FamilyQuotientModel.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. #[ApiResource(operations: [])]
  10. #[ORM\Entity]
  11. class FamilyQuotientModel
  12. {
  13. #[ORM\Id]
  14. #[ORM\Column]
  15. #[ORM\GeneratedValue]
  16. private int $id;
  17. #[ORM\ManyToOne(targetEntity: Organization::class, cascade: [], inversedBy: 'familyQuotientModels')]
  18. #[ORM\JoinColumn(nullable: false)]
  19. protected Organization $organization;
  20. #[ORM\OneToMany(mappedBy: 'familyQuotientModel', targetEntity: FamilyQuotientBand::class, cascade: ['persist'], orphanRemoval: true)]
  21. protected Collection $familyQuotientBands;
  22. #[ORM\OneToMany(mappedBy: 'familyQuotientModel', targetEntity: IntangiblePriceAndDiscount::class, cascade: [], orphanRemoval: false)]
  23. protected Collection $intangiblePriceAndDiscounts;
  24. public function getId(): int
  25. {
  26. return $this->id;
  27. }
  28. public function setId(int $id): self
  29. {
  30. $this->id = $id;
  31. return $this;
  32. }
  33. public function getOrganization(): Organization
  34. {
  35. return $this->organization;
  36. }
  37. public function setOrganization(Organization $organization): self
  38. {
  39. $this->organization = $organization;
  40. return $this;
  41. }
  42. public function getFamilyQuotientBands(): Collection
  43. {
  44. return $this->familyQuotientBands;
  45. }
  46. public function addFamilyQuotientBand(FamilyQuotientBand $familyQuotientBand): self
  47. {
  48. if (!$this->familyQuotientBands->contains($familyQuotientBand)) {
  49. $this->familyQuotientBands[] = $familyQuotientBand;
  50. $familyQuotientBand->setFamilyQuotientModel($this);
  51. }
  52. return $this;
  53. }
  54. public function removeFamilyQuotientBand(FamilyQuotientBand $familyQuotientBand): self
  55. {
  56. if ($this->familyQuotientBands->removeElement($familyQuotientBand)) {
  57. $familyQuotientBand->setFamilyQuotientModel(null);
  58. }
  59. return $this;
  60. }
  61. public function getIntangiblePriceAndDiscounts(): Collection
  62. {
  63. return $this->intangiblePriceAndDiscounts;
  64. }
  65. public function addIntangiblePriceAndDiscount(IntangiblePriceAndDiscount $intangiblePriceAndDiscount): self
  66. {
  67. if (!$this->intangiblePriceAndDiscounts->contains($intangiblePriceAndDiscount)) {
  68. $this->intangiblePriceAndDiscounts[] = $intangiblePriceAndDiscount;
  69. $intangiblePriceAndDiscount->setFamilyQuotientModel($this);
  70. }
  71. return $this;
  72. }
  73. public function removeIntangiblePriceAndDiscount(IntangiblePriceAndDiscount $intangiblePriceAndDiscount): self
  74. {
  75. if ($this->intangiblePriceAndDiscounts->removeElement($intangiblePriceAndDiscount)) {
  76. $intangiblePriceAndDiscount->setFamilyQuotientModel(null);
  77. }
  78. return $this;
  79. }
  80. }