SourceItemConfiguration.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. declare(strict_types=1);
  7. namespace Magento\InventoryLowQuantityNotification\Model;
  8. use Magento\InventoryLowQuantityNotificationApi\Api\Data\SourceItemConfigurationExtensionInterface;
  9. use Magento\InventoryLowQuantityNotificationApi\Api\Data\SourceItemConfigurationInterface;
  10. use Magento\Framework\Model\AbstractExtensibleModel;
  11. /**
  12. * @inheritdoc
  13. */
  14. class SourceItemConfiguration extends AbstractExtensibleModel implements SourceItemConfigurationInterface
  15. {
  16. /**
  17. * @inheritdoc
  18. */
  19. public function getSourceCode(): ?string
  20. {
  21. return $this->getData(self::SOURCE_CODE);
  22. }
  23. /**
  24. * @inheritdoc
  25. */
  26. public function setSourceCode(string $sourceCode): void
  27. {
  28. $this->setData(self::SOURCE_CODE, $sourceCode);
  29. }
  30. /**
  31. * @inheritdoc
  32. */
  33. public function getNotifyStockQty(): ?float
  34. {
  35. return $this->getData(self::INVENTORY_NOTIFY_QTY) === null ?
  36. null:
  37. (float)$this->getData(self::INVENTORY_NOTIFY_QTY);
  38. }
  39. /**
  40. * @inheritdoc
  41. */
  42. public function setNotifyStockQty(?float $quantity): void
  43. {
  44. $this->setData(self::INVENTORY_NOTIFY_QTY, $quantity);
  45. }
  46. /**
  47. * @inheritdoc
  48. */
  49. public function getSku(): ?string
  50. {
  51. return $this->getData(self::SKU);
  52. }
  53. /**
  54. * @inheritdoc
  55. */
  56. public function setSku(string $sku): void
  57. {
  58. $this->setData(self::SKU, $sku);
  59. }
  60. /**
  61. * @inheritdoc
  62. */
  63. public function getExtensionAttributes(): ?SourceItemConfigurationExtensionInterface
  64. {
  65. $extensionAttributes = $this->_getExtensionAttributes();
  66. if (null === $extensionAttributes) {
  67. $extensionAttributes = $this->extensionAttributesFactory->create(SourceItemConfigurationInterface::class);
  68. $this->setExtensionAttributes($extensionAttributes);
  69. }
  70. return $extensionAttributes;
  71. }
  72. /**
  73. * @inheritdoc
  74. */
  75. public function setExtensionAttributes(SourceItemConfigurationExtensionInterface $extensionAttributes): void
  76. {
  77. $this->_setExtensionAttributes($extensionAttributes);
  78. }
  79. }