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

Public Member Functions

 getStockId ()
 
 setStockId (?int $stockId)
 
 getName ()
 
 setName (?string $name)
 
 getExtensionAttributes ()
 
 setExtensionAttributes (StockExtensionInterface $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 StockInterface
 setExtensionAttributes (\Magento\InventoryApi\Api\Data\StockExtensionInterface $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 StockInterface
const STOCK_ID = 'stock_id'
 
const NAME = 'name'
 
- 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 Stock.php.

Member Function Documentation

◆ _construct()

_construct ( )
protected

Definition at line 25 of file Stock.php.

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

◆ getExtensionAttributes()

getExtensionAttributes ( )

Retrieve existing extension attributes object

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

Implements StockInterface.

Definition at line 67 of file Stock.php.

67  : ?StockExtensionInterface
68  {
70  if (null === $extensionAttributes) {
71  $extensionAttributes = $this->extensionAttributesFactory->create(StockInterface::class);
73  }
74  return $extensionAttributes;
75  }
setExtensionAttributes(StockExtensionInterface $extensionAttributes)
Definition: Stock.php:80

◆ getName()

getName ( )

Get stock name

Returns
string|null

Implements StockInterface.

Definition at line 51 of file Stock.php.

51  : ?string
52  {
53  return $this->getData(self::NAME);
54  }

◆ getStockId()

getStockId ( )

#- Get stock id

Returns
int|null

Implements StockInterface.

Definition at line 33 of file Stock.php.

33  : ?int
34  {
35  return $this->getData(self::STOCK_ID) === null ?
36  null:
37  (int)$this->getData(self::STOCK_ID);
38  }

◆ setExtensionAttributes()

setExtensionAttributes ( StockExtensionInterface  $extensionAttributes)

Definition at line 80 of file Stock.php.

80  : void
81  {
83  }
_setExtensionAttributes(\Magento\Framework\Api\ExtensionAttributesInterface $extensionAttributes)

◆ setName()

setName ( ?string  $name)

Set stock name

Parameters
string | null$name
Returns
void

Implements StockInterface.

Definition at line 59 of file Stock.php.

59  : void
60  {
61  $this->setData(self::NAME, $name);
62  }
if(!isset($_GET['name'])) $name
Definition: log.php:14

◆ setStockId()

setStockId ( ?int  $stockId)

Set stock id

Parameters
int | null$stockId
Returns
void

Implements StockInterface.

Definition at line 43 of file Stock.php.

43  : void
44  {
45  $this->setData(self::STOCK_ID, $stockId);
46  }

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