StockSourceLink.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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\Inventory\Model;
  8. use Magento\Framework\Model\AbstractExtensibleModel;
  9. use Magento\Inventory\Model\ResourceModel\StockSourceLink as StockSourceLinkResourceModel;
  10. use Magento\InventoryApi\Api\Data\StockSourceLinkExtensionInterface;
  11. use Magento\InventoryApi\Api\Data\StockSourceLinkInterface;
  12. /**
  13. * {@inheritdoc}
  14. *
  15. * @codeCoverageIgnore
  16. */
  17. class StockSourceLink extends AbstractExtensibleModel implements StockSourceLinkInterface
  18. {
  19. /**
  20. * @inheritdoc
  21. */
  22. protected function _construct()
  23. {
  24. $this->_init(StockSourceLinkResourceModel::class);
  25. }
  26. /**
  27. * @inheritdoc
  28. */
  29. public function getSourceCode(): ?string
  30. {
  31. return $this->getData(self::SOURCE_CODE);
  32. }
  33. /**
  34. * @inheritdoc
  35. */
  36. public function setSourceCode(?string $sourceCode): void
  37. {
  38. $this->setData(self::SOURCE_CODE, $sourceCode);
  39. }
  40. /**
  41. * @inheritdoc
  42. */
  43. public function getStockId(): ?int
  44. {
  45. return $this->getData(self::STOCK_ID) === null ?
  46. null:
  47. (int)$this->getData(self::STOCK_ID);
  48. }
  49. /**
  50. * @inheritdoc
  51. */
  52. public function setStockId(?int $stockId): void
  53. {
  54. $this->setData(self::STOCK_ID, $stockId);
  55. }
  56. /**
  57. * @inheritdoc
  58. */
  59. public function getPriority(): ?int
  60. {
  61. return $this->getData(self::PRIORITY) === null ?
  62. null:
  63. (int)$this->getData(self::PRIORITY);
  64. }
  65. /**
  66. * @inheritdoc
  67. */
  68. public function setPriority(?int $priority): void
  69. {
  70. $this->setData(self::PRIORITY, $priority);
  71. }
  72. /**
  73. * @inheritdoc
  74. */
  75. public function getExtensionAttributes(): ?StockSourceLinkExtensionInterface
  76. {
  77. $extensionAttributes = $this->_getExtensionAttributes();
  78. if (null === $extensionAttributes) {
  79. $extensionAttributes = $this->extensionAttributesFactory->create(StockSourceLinkInterface::class);
  80. $this->setExtensionAttributes($extensionAttributes);
  81. }
  82. return $extensionAttributes;
  83. }
  84. /**
  85. * @inheritdoc
  86. */
  87. public function setExtensionAttributes(StockSourceLinkExtensionInterface $extensionAttributes): void
  88. {
  89. $this->_setExtensionAttributes($extensionAttributes);
  90. }
  91. }