Source.php 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  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\Source as SourceResourceModel;
  10. use Magento\InventoryApi\Api\Data\SourceExtensionInterface;
  11. use Magento\InventoryApi\Api\Data\SourceInterface;
  12. /**
  13. * {@inheritdoc}
  14. *
  15. * @codeCoverageIgnore
  16. */
  17. class Source extends AbstractExtensibleModel implements SourceInterface
  18. {
  19. /**
  20. * @inheritdoc
  21. */
  22. protected function _construct()
  23. {
  24. $this->_init(SourceResourceModel::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 getName(): ?string
  44. {
  45. return $this->getData(self::NAME);
  46. }
  47. /**
  48. * @inheritdoc
  49. */
  50. public function setName(?string $name): void
  51. {
  52. $this->setData(self::NAME, $name);
  53. }
  54. /**
  55. * @inheritdoc
  56. */
  57. public function getEmail(): ?string
  58. {
  59. return $this->getData(self::EMAIL);
  60. }
  61. /**
  62. * @inheritdoc
  63. */
  64. public function setEmail(?string $email): void
  65. {
  66. $this->setData(self::EMAIL, $email);
  67. }
  68. /**
  69. * @inheritdoc
  70. */
  71. public function getContactName(): ?string
  72. {
  73. return $this->getData(self::CONTACT_NAME);
  74. }
  75. /**
  76. * @inheritdoc
  77. */
  78. public function setContactName(?string $contactName): void
  79. {
  80. $this->setData(self::CONTACT_NAME, $contactName);
  81. }
  82. /**
  83. * @inheritdoc
  84. */
  85. public function isEnabled() :?bool
  86. {
  87. return $this->getData(self::ENABLED) === null ?
  88. null:
  89. (bool)$this->getData(self::ENABLED);
  90. }
  91. /**
  92. * @inheritdoc
  93. */
  94. public function setEnabled(?bool $enabled): void
  95. {
  96. $this->setData(self::ENABLED, $enabled);
  97. }
  98. /**
  99. * @inheritdoc
  100. */
  101. public function getDescription(): ?string
  102. {
  103. return $this->getData(self::DESCRIPTION);
  104. }
  105. /**
  106. * @inheritdoc
  107. */
  108. public function setDescription(?string $description): void
  109. {
  110. $this->setData(self::DESCRIPTION, $description);
  111. }
  112. /**
  113. * @inheritdoc
  114. */
  115. public function getLatitude(): ?float
  116. {
  117. return $this->getData(self::LATITUDE) === null ?
  118. null:
  119. (float)$this->getData(self::LATITUDE);
  120. }
  121. /**
  122. * @inheritdoc
  123. */
  124. public function setLatitude(?float $latitude): void
  125. {
  126. $this->setData(self::LATITUDE, $latitude);
  127. }
  128. /**
  129. * @inheritdoc
  130. */
  131. public function getLongitude(): ?float
  132. {
  133. return $this->getData(self::LONGITUDE) === null ?
  134. null:
  135. (float)$this->getData(self::LONGITUDE);
  136. }
  137. /**
  138. * @inheritdoc
  139. */
  140. public function setLongitude(?float $longitude): void
  141. {
  142. $this->setData(self::LONGITUDE, $longitude);
  143. }
  144. /**
  145. * @inheritdoc
  146. */
  147. public function getCountryId(): ?string
  148. {
  149. return $this->getData(self::COUNTRY_ID);
  150. }
  151. /**
  152. * @inheritdoc
  153. */
  154. public function setCountryId(?string $countryId): void
  155. {
  156. $this->setData(self::COUNTRY_ID, $countryId);
  157. }
  158. /**
  159. * @inheritdoc
  160. */
  161. public function getRegionId(): ?int
  162. {
  163. return $this->getData(self::REGION_ID) === null ?
  164. null:
  165. (int)$this->getData(self::REGION_ID);
  166. }
  167. /**
  168. * @inheritdoc
  169. */
  170. public function setRegionId(?int $regionId): void
  171. {
  172. $this->setData(self::REGION_ID, $regionId);
  173. }
  174. /**
  175. * @inheritdoc
  176. */
  177. public function getRegion(): ?string
  178. {
  179. return $this->getData(self::REGION);
  180. }
  181. /**
  182. * @inheritdoc
  183. */
  184. public function setRegion(?string $region): void
  185. {
  186. $this->setData(self::REGION, $region);
  187. }
  188. /**
  189. * @inheritdoc
  190. */
  191. public function getCity(): ?string
  192. {
  193. return $this->getData(self::CITY);
  194. }
  195. /**
  196. * @inheritdoc
  197. */
  198. public function setCity(?string $city): void
  199. {
  200. $this->setData(self::CITY, $city);
  201. }
  202. /**
  203. * @inheritdoc
  204. */
  205. public function getStreet(): ?string
  206. {
  207. return $this->getData(self::STREET);
  208. }
  209. /**
  210. * @inheritdoc
  211. */
  212. public function setStreet(?string $street): void
  213. {
  214. $this->setData(self::STREET, $street);
  215. }
  216. /**
  217. * @inheritdoc
  218. */
  219. public function getPostcode(): ?string
  220. {
  221. return $this->getData(self::POSTCODE);
  222. }
  223. /**
  224. * @inheritdoc
  225. */
  226. public function setPostcode(?string $postcode): void
  227. {
  228. $this->setData(self::POSTCODE, $postcode);
  229. }
  230. /**
  231. * @inheritdoc
  232. */
  233. public function getPhone(): ?string
  234. {
  235. return $this->getData(self::PHONE);
  236. }
  237. /**
  238. * @inheritdoc
  239. */
  240. public function setPhone(?string $phone): void
  241. {
  242. $this->setData(self::PHONE, $phone);
  243. }
  244. /**
  245. * @inheritdoc
  246. */
  247. public function getFax(): ?string
  248. {
  249. return $this->getData(self::FAX);
  250. }
  251. /**
  252. * @inheritdoc
  253. */
  254. public function setFax(?string $fax): void
  255. {
  256. $this->setData(self::FAX, $fax);
  257. }
  258. /**
  259. * @inheritdoc
  260. */
  261. public function isUseDefaultCarrierConfig(): ?bool
  262. {
  263. return true;
  264. }
  265. /**
  266. * @inheritdoc
  267. */
  268. public function setUseDefaultCarrierConfig(?bool $useDefaultCarrierConfig): void
  269. {
  270. $this->setData(self::USE_DEFAULT_CARRIER_CONFIG, $useDefaultCarrierConfig);
  271. }
  272. /**
  273. * @inheritdoc
  274. */
  275. public function getCarrierLinks(): ?array
  276. {
  277. return $this->getData(self::CARRIER_LINKS);
  278. }
  279. /**
  280. * @inheritdoc
  281. */
  282. public function setCarrierLinks(?array $carrierLinks): void
  283. {
  284. $this->setData(self::CARRIER_LINKS, $carrierLinks);
  285. }
  286. /**
  287. * @inheritdoc
  288. */
  289. public function getExtensionAttributes(): ?SourceExtensionInterface
  290. {
  291. $extensionAttributes = $this->_getExtensionAttributes();
  292. if (null === $extensionAttributes) {
  293. $extensionAttributes = $this->extensionAttributesFactory->create(SourceInterface::class);
  294. $this->setExtensionAttributes($extensionAttributes);
  295. }
  296. return $extensionAttributes;
  297. }
  298. /**
  299. * @inheritdoc
  300. */
  301. public function setExtensionAttributes(SourceExtensionInterface $extensionAttributes): void
  302. {
  303. $this->_setExtensionAttributes($extensionAttributes);
  304. }
  305. }