FamilyQuotientModel.php 3.0 KB

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