src/Entity/System/CodeDiscountRule.php line 21

Open in your IDE?
  1. <?php
  2. namespace App\Entity\System;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\ORM\Mapping as ORM;
  5. /**
  6. * Class CodeDiscountRule
  7. *
  8. * @ORM\Table(
  9. * name="code_discount_rule",
  10. * uniqueConstraints={ *
  11. *
  12. * @ORM\UniqueConstraint(name="uk_type_entity", columns={"code_discount_rule_type_id", "entity_id"}),
  13. * }
  14. * )
  15. *
  16. * @ORM\Entity(repositoryClass="App\Repository\System\CodeDiscountRuleRepository")
  17. */
  18. class CodeDiscountRule
  19. {
  20. /**
  21. * @ORM\Id
  22. *
  23. * @ORM\GeneratedValue()
  24. *
  25. * @ORM\Column(type="integer")
  26. */
  27. private int $id;
  28. /**
  29. * @ORM\Column(type="string", unique=true)
  30. */
  31. private string $name;
  32. /**
  33. * @ORM\Column(type="integer", nullable=true)
  34. */
  35. private ?int $entityId;
  36. /**
  37. * @var ArrayCollection<int, CodeDiscount>|CodeDiscount[]
  38. *
  39. * @ORM\ManyToMany(targetEntity="CodeDiscount", mappedBy="codeDiscountRules")
  40. */
  41. private $codeDiscounts;
  42. /**
  43. * @ORM\ManyToOne(targetEntity="CodeDiscountRuleType", inversedBy="codeDiscountRules")
  44. */
  45. private CodeDiscountRuleType $codeDiscountRuleType;
  46. public function getId(): int
  47. {
  48. return $this->id;
  49. }
  50. public function getName(): string
  51. {
  52. return $this->name;
  53. }
  54. public function setName(string $name): CodeDiscountRule
  55. {
  56. $this->name = $name;
  57. return $this;
  58. }
  59. /**
  60. * @return ArrayCollection<int, CodeDiscount>
  61. */
  62. public function getCodeDiscounts(): ArrayCollection
  63. {
  64. return $this->codeDiscounts;
  65. }
  66. /**
  67. * @param ArrayCollection<int, CodeDiscount> $codeDiscounts
  68. *
  69. * @return $this
  70. */
  71. public function setCodeDiscounts(ArrayCollection $codeDiscounts): CodeDiscountRule
  72. {
  73. $this->codeDiscounts = $codeDiscounts;
  74. return $this;
  75. }
  76. public function getCodeDiscountRuleType(): CodeDiscountRuleType
  77. {
  78. return $this->codeDiscountRuleType;
  79. }
  80. public function setCodeDiscountRuleType(CodeDiscountRuleType $codeDiscountRuleType): CodeDiscountRule
  81. {
  82. $this->codeDiscountRuleType = $codeDiscountRuleType;
  83. return $this;
  84. }
  85. public function getEntityId(): ?int
  86. {
  87. return $this->entityId;
  88. }
  89. public function setEntityId(?int $entityId): CodeDiscountRule
  90. {
  91. $this->entityId = $entityId;
  92. return $this;
  93. }
  94. }