Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Member Functions
SourceItem Class Reference
Inheritance diagram for SourceItem:
AbstractExtensibleModel SourceItemInterface AbstractModel CustomAttributesDataInterface ExtensibleDataInterface DataObject ExtensibleDataInterface

Public Member Functions

 getSku ()
 
 setSku (?string $sku)
 
 getSourceCode ()
 
 setSourceCode (?string $sourceCode)
 
 getQuantity ()
 
 setQuantity (?float $quantity)
 
 getStatus ()
 
 setStatus (?int $status)
 
 getExtensionAttributes ()
 
 setExtensionAttributes (SourceItemExtensionInterface $extensionAttributes)
 
- Public Member Functions inherited from AbstractExtensibleModel
 __construct (\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[])
 
 getCustomAttributes ()
 
 getCustomAttribute ($attributeCode)
 
 setCustomAttributes (array $attributes)
 
 setCustomAttribute ($attributeCode, $attributeValue)
 
 setData ($key, $value=null)
 
 unsetData ($key=null)
 
 getData ($key='', $index=null)
 
 setId ($value)
 
 __sleep ()
 
 __wakeup ()
 
- Public Member Functions inherited from AbstractModel
 __construct (\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[])
 
 __sleep ()
 
 __wakeup ()
 
 setIdFieldName ($name)
 
 getIdFieldName ()
 
 getId ()
 
 setId ($value)
 
 isDeleted ($isDeleted=null)
 
 hasDataChanges ()
 
 setData ($key, $value=null)
 
 unsetData ($key=null)
 
 setDataChanges ($value)
 
 getOrigData ($key=null)
 
 setOrigData ($key=null, $data=null)
 
 dataHasChangedFor ($field)
 
 getResourceName ()
 
 getResourceCollection ()
 
 getCollection ()
 
 load ($modelId, $field=null)
 
 beforeLoad ($identifier, $field=null)
 
 afterLoad ()
 
 isSaveAllowed ()
 
 setHasDataChanges ($flag)
 
 save ()
 
 afterCommitCallback ()
 
 isObjectNew ($flag=null)
 
 beforeSave ()
 
 validateBeforeSave ()
 
 getCacheTags ()
 
 cleanModelCache ()
 
 afterSave ()
 
 delete ()
 
 beforeDelete ()
 
 afterDelete ()
 
 afterDeleteCommit ()
 
 getResource ()
 
 getEntityId ()
 
 setEntityId ($entityId)
 
 clearInstance ()
 
 getStoredData ()
 
 getEventPrefix ()
 
- Public Member Functions inherited from DataObject
 __construct (array $data=[])
 
 addData (array $arr)
 
 setData ($key, $value=null)
 
 unsetData ($key=null)
 
 getData ($key='', $index=null)
 
 getDataByPath ($path)
 
 getDataByKey ($key)
 
 setDataUsingMethod ($key, $args=[])
 
 getDataUsingMethod ($key, $args=null)
 
 hasData ($key='')
 
 toArray (array $keys=[])
 
 convertToArray (array $keys=[])
 
 toXml (array $keys=[], $rootName='item', $addOpenTag=false, $addCdata=true)
 
 convertToXml (array $arrAttributes=[], $rootName='item', $addOpenTag=false, $addCdata=true)
 
 toJson (array $keys=[])
 
 convertToJson (array $keys=[])
 
 toString ($format='')
 
 __call ($method, $args)
 
 isEmpty ()
 
 serialize ($keys=[], $valueSeparator='=', $fieldSeparator=' ', $quote='"')
 
 debug ($data=null, &$objects=[])
 
 offsetSet ($offset, $value)
 
 offsetExists ($offset)
 
 offsetUnset ($offset)
 
 offsetGet ($offset)
 
- Public Member Functions inherited from SourceItemInterface
 setExtensionAttributes (\Magento\InventoryApi\Api\Data\SourceItemExtensionInterface $extensionAttributes)
 

Protected Member Functions

 _construct ()
 
- Protected Member Functions inherited from AbstractExtensibleModel
 filterCustomAttributes ($data)
 
 initializeCustomAttributes ()
 
 convertCustomAttributeValues (array &$customAttributes)
 
 getCustomAttributesCodes ()
 
 _setExtensionAttributes (\Magento\Framework\Api\ExtensionAttributesInterface $extensionAttributes)
 
 _getExtensionAttributes ()
 
- Protected Member Functions inherited from AbstractModel
 _construct ()
 
 _init ($resourceModel)
 
 _setResourceModel ($resourceName, $collectionName=null)
 
 _getResource ()
 
 _getEventData ()
 
 _beforeLoad ($modelId, $field=null)
 
 _afterLoad ()
 
 _hasModelChanged ()
 
 _getValidatorBeforeSave ()
 
 _createValidatorBeforeSave ()
 
 _getValidationRulesBeforeSave ()
 
 _clearReferences ()
 
 _clearData ()
 
- Protected Member Functions inherited from DataObject
 _getData ($key)
 
 _underscore ($name)
 

Additional Inherited Members

- Data Fields inherited from CustomAttributesDataInterface
const CUSTOM_ATTRIBUTES = 'custom_attributes'
 
- Data Fields inherited from ExtensibleDataInterface
const EXTENSION_ATTRIBUTES_KEY = 'extension_attributes'
 
- Data Fields inherited from SourceItemInterface
const SKU = 'sku'
 
const SOURCE_CODE = 'source_code'
 
const QUANTITY = 'quantity'
 
const STATUS = 'status'
 
const STATUS_OUT_OF_STOCK = 0
 
const STATUS_IN_STOCK = 1
 
- Protected Attributes inherited from AbstractExtensibleModel
 $extensionAttributesFactory
 
 $extensionAttributes
 
 $customAttributeFactory
 
 $customAttributesCodes = null
 
 $customAttributesChanged = false
 
- Protected Attributes inherited from AbstractModel
 $_eventPrefix = 'core_abstract'
 
 $_eventObject = 'object'
 
 $_idFieldName = 'id'
 
 $_hasDataChanges = false
 
 $_origData
 
 $_isDeleted = false
 
 $_resource
 
 $_resourceCollection
 
 $_resourceName
 
 $_collectionName
 
 $_cacheTag = false
 
 $_dataSaveAllowed = true
 
 $_isObjectNew = null
 
 $_validatorBeforeSave = null
 
 $_eventManager
 
 $_cacheManager
 
 $_registry
 
 $_logger
 
 $_appState
 
 $_actionValidator
 
 $storedData = []
 
- Protected Attributes inherited from DataObject
 $_data = []
 
- Static Protected Attributes inherited from DataObject
static $_underscoreCache = []
 

Detailed Description

{}

@codeCoverageIgnore

Definition at line 20 of file SourceItem.php.

Member Function Documentation

◆ _construct()

_construct ( )
protected

Definition at line 25 of file SourceItem.php.

26  {
27  $this->_init(SourceItemResourceModel::class);
28  }

◆ getExtensionAttributes()

getExtensionAttributes ( )

Retrieve existing extension attributes object

Returns
\Magento\InventoryApi\Api\Data\SourceItemExtensionInterface|null

Implements SourceItemInterface.

Definition at line 101 of file SourceItem.php.

101  : ?SourceItemExtensionInterface
102  {
104  if (null === $extensionAttributes) {
105  $extensionAttributes = $this->extensionAttributesFactory->create(SourceItemInterface::class);
107  }
108  return $extensionAttributes;
109  }
setExtensionAttributes(SourceItemExtensionInterface $extensionAttributes)
Definition: SourceItem.php:114

◆ getQuantity()

getQuantity ( )

Get source item quantity

Returns
float|null

Implements SourceItemInterface.

Definition at line 65 of file SourceItem.php.

65  : ?float
66  {
67  return $this->getData(self::QUANTITY) === null ?
68  null:
69  (float)$this->getData(self::QUANTITY);
70  }

◆ getSku()

getSku ( )

#- Get source item sku

Returns
string|null

Implements SourceItemInterface.

Definition at line 33 of file SourceItem.php.

33  : ?string
34  {
35  return $this->getData(self::SKU);
36  }

◆ getSourceCode()

getSourceCode ( )

Get source code

Returns
string|null

Implements SourceItemInterface.

Definition at line 49 of file SourceItem.php.

49  : ?string
50  {
51  return $this->getData(self::SOURCE_CODE);
52  }

◆ getStatus()

getStatus ( )

Get source item status (One of self::STATUS_*)

Returns
int|null

Implements SourceItemInterface.

Definition at line 83 of file SourceItem.php.

83  : ?int
84  {
85  return $this->getData(self::STATUS) === null ?
86  null:
87  (int)$this->getData(self::STATUS);
88  }

◆ setExtensionAttributes()

setExtensionAttributes ( SourceItemExtensionInterface  $extensionAttributes)

Definition at line 114 of file SourceItem.php.

114  : void
115  {
117  }
_setExtensionAttributes(\Magento\Framework\Api\ExtensionAttributesInterface $extensionAttributes)

◆ setQuantity()

setQuantity ( ?float  $quantity)

Set source item quantity

Parameters
float | null$quantity
Returns
void

Implements SourceItemInterface.

Definition at line 75 of file SourceItem.php.

75  : void
76  {
77  $this->setData(self::QUANTITY, $quantity);
78  }

◆ setSku()

setSku ( ?string  $sku)

Set source item sku

Parameters
string | null$sku
Returns
void

Implements SourceItemInterface.

Definition at line 41 of file SourceItem.php.

41  : void
42  {
43  $this->setData(self::SKU, $sku);
44  }

◆ setSourceCode()

setSourceCode ( ?string  $sourceCode)

Set source code

Parameters
string | null$sourceCode
Returns
void

Implements SourceItemInterface.

Definition at line 57 of file SourceItem.php.

57  : void
58  {
59  $this->setData(self::SOURCE_CODE, $sourceCode);
60  }
$sourceCode
Definition: inventory.phtml:11

◆ setStatus()

setStatus ( ?int  $status)

Set source item status (One of self::STATUS_*)

Parameters
int | null$status
Returns
void

Implements SourceItemInterface.

Definition at line 93 of file SourceItem.php.

93  : void
94  {
95  $this->setData(self::STATUS, $status);
96  }
$status
Definition: order_status.php:8

The documentation for this class was generated from the following file: