Condition.php 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <?php
  2. /**
  3. * Data Model implementing the Address interface
  4. *
  5. * Copyright © Magento, Inc. All rights reserved.
  6. * See COPYING.txt for license details.
  7. */
  8. namespace Magento\SalesRule\Model\Data;
  9. use Magento\SalesRule\Api\Data\ConditionInterface;
  10. /**
  11. * Class Condition
  12. *
  13. * @codeCoverageIgnore
  14. */
  15. class Condition extends \Magento\Framework\Api\AbstractExtensibleObject implements
  16. \Magento\SalesRule\Api\Data\ConditionInterface
  17. {
  18. const KEY_CONDITION_TYPE = 'condition_type';
  19. const KEY_CONDITIONS = 'conditions';
  20. const KEY_AGGREGATOR_TYPE = 'aggregator_type';
  21. const KEY_OPERATOR = 'operator';
  22. const KEY_ATTRIBUTE_NAME = 'attribute_name';
  23. const KEY_VALUE = 'value';
  24. /**
  25. * Get condition type
  26. *
  27. * @return string
  28. */
  29. public function getConditionType()
  30. {
  31. return $this->_get(self::KEY_CONDITION_TYPE);
  32. }
  33. /**
  34. * @param string $conditionType
  35. * @return $this
  36. */
  37. public function setConditionType($conditionType)
  38. {
  39. return $this->setData(self::KEY_CONDITION_TYPE, $conditionType);
  40. }
  41. /**
  42. * Return list of conditions
  43. *
  44. * @return ConditionInterface[]|null
  45. */
  46. public function getConditions()
  47. {
  48. return $this->_get(self::KEY_CONDITIONS);
  49. }
  50. /**
  51. * Set conditions
  52. *
  53. * @param ConditionInterface[]|null $conditions
  54. * @return $this
  55. */
  56. public function setConditions(array $conditions = null)
  57. {
  58. return $this->setData(self::KEY_CONDITIONS, $conditions);
  59. }
  60. /**
  61. * Return the aggregator type
  62. *
  63. * @return string|null
  64. */
  65. public function getAggregatorType()
  66. {
  67. return $this->_get(self::KEY_AGGREGATOR_TYPE);
  68. }
  69. /**
  70. * Set the aggregator type
  71. *
  72. * @param string $aggregatorType
  73. * @return $this
  74. */
  75. public function setAggregatorType($aggregatorType)
  76. {
  77. return $this->setData(self::KEY_AGGREGATOR_TYPE, $aggregatorType);
  78. }
  79. /**
  80. * Return the operator of the condition
  81. *
  82. * @return string
  83. */
  84. public function getOperator()
  85. {
  86. return $this->_get(self::KEY_OPERATOR);
  87. }
  88. /**
  89. * Set the operator of the condition
  90. *
  91. * @param string $operator
  92. * @return $this
  93. */
  94. public function setOperator($operator)
  95. {
  96. return $this->setData(self::KEY_OPERATOR, $operator);
  97. }
  98. /**
  99. * Return the attribute name of the condition
  100. *
  101. * @return string|null
  102. */
  103. public function getAttributeName()
  104. {
  105. return $this->_get(self::KEY_ATTRIBUTE_NAME);
  106. }
  107. /**
  108. * Set the attribute name of the condition
  109. *
  110. * @param string $attributeName
  111. * @return $this
  112. */
  113. public function setAttributeName($attributeName)
  114. {
  115. return $this->setData(self::KEY_ATTRIBUTE_NAME, $attributeName);
  116. }
  117. /**
  118. * Return the value of the condition
  119. *
  120. * @return mixed
  121. */
  122. public function getValue()
  123. {
  124. return $this->_get(self::KEY_VALUE);
  125. }
  126. /**
  127. * Return the value of the condition
  128. *
  129. * @param mixed $value
  130. * @return $this
  131. */
  132. public function setValue($value)
  133. {
  134. return $this->setData(self::KEY_VALUE, $value);
  135. }
  136. /**
  137. * {@inheritdoc}
  138. *
  139. * @return \Magento\SalesRule\Api\Data\ConditionExtensionInterface|null
  140. */
  141. public function getExtensionAttributes()
  142. {
  143. return $this->_getExtensionAttributes();
  144. }
  145. /**
  146. * {@inheritdoc}
  147. *
  148. * @param \Magento\SalesRule\Api\Data\ConditionExtensionInterface $extensionAttributes
  149. * @return $this
  150. */
  151. public function setExtensionAttributes(
  152. \Magento\SalesRule\Api\Data\ConditionExtensionInterface $extensionAttributes
  153. ) {
  154. return $this->_setExtensionAttributes($extensionAttributes);
  155. }
  156. }