Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Data Fields
Link Class Reference
Inheritance diagram for Link:
AbstractExtensibleModel LinkInterface AbstractModel CustomAttributesDataInterface ExtensibleDataInterface DataObject ExtensibleDataInterface

Public Member Functions

 getId ()
 
 setId ($id)
 
 getSku ()
 
 getOptionId ()
 
 getQty ()
 
 getPosition ()
 
 getIsDefault ()
 
 getPrice ()
 
 getPriceType ()
 
 getCanChangeQuantity ()
 
 setSku ($sku)
 
 setOptionId ($optionId)
 
 setQty ($qty)
 
 setPosition ($position)
 
 setIsDefault ($isDefault)
 
 setPrice ($price)
 
 setPriceType ($priceType)
 
 setCanChangeQuantity ($canChangeQuantity)
 
 getExtensionAttributes ()
 
 setExtensionAttributes (\Magento\Bundle\Api\Data\LinkExtensionInterface $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)
 

Data Fields

const KEY_ID = 'id'
 
const KEY_SKU = 'sku'
 
const KEY_OPTION_ID = 'option_id'
 
const KEY_QTY = 'qty'
 
const KEY_POSITION = 'position'
 
const KEY_IS_DEFAULT = 'is_default'
 
const KEY_PRICE = 'price'
 
const KEY_PRICE_TYPE = 'price_type'
 
const KEY_CAN_CHANGE_QUANTITY = 'selection_can_change_quantity'
 
- Data Fields inherited from CustomAttributesDataInterface
const CUSTOM_ATTRIBUTES = 'custom_attributes'
 
- Data Fields inherited from ExtensibleDataInterface
const EXTENSION_ATTRIBUTES_KEY = 'extension_attributes'
 

Additional Inherited Members

- 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)
 
- 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

Class Link @codeCoverageIgnore

Definition at line 13 of file Link.php.

Member Function Documentation

◆ getCanChangeQuantity()

getCanChangeQuantity ( )

{Get whether quantity could be changed

Returns
int|null
}

Implements LinkInterface.

Definition at line 105 of file Link.php.

106  {
107  return $this->getData(self::KEY_CAN_CHANGE_QUANTITY);
108  }

◆ getExtensionAttributes()

getExtensionAttributes ( )

{Retrieve existing extension attributes object or create a new one.

Returns
\Magento\Bundle\Api\Data\LinkExtensionInterface|null
}

Returns
\Magento\Bundle\Api\Data\LinkExtensionInterface|null

Implements LinkInterface.

Definition at line 203 of file Link.php.

◆ getId()

getId ( )

#- {Get the identifier

Returns
string|null
}

Implements LinkInterface.

Definition at line 33 of file Link.php.

34  {
35  return $this->getData(self::KEY_ID);
36  }

◆ getIsDefault()

getIsDefault ( )

{Get is default

Returns
bool @SuppressWarnings(PHPMD.BooleanGetMethodName)
}

Implements LinkInterface.

Definition at line 81 of file Link.php.

82  {
83  return $this->getData(self::KEY_IS_DEFAULT);
84  }

◆ getOptionId()

getOptionId ( )

{Get option id

Returns
int|null
}

Implements LinkInterface.

Definition at line 57 of file Link.php.

58  {
59  return $this->getData(self::KEY_OPTION_ID);
60  }

◆ getPosition()

getPosition ( )

{Get position

Returns
int|null
}

Implements LinkInterface.

Definition at line 73 of file Link.php.

74  {
75  return $this->getData(self::KEY_POSITION);
76  }

◆ getPrice()

getPrice ( )

{Get price

Returns
float
}

Implements LinkInterface.

Definition at line 89 of file Link.php.

90  {
91  return $this->getData(self::KEY_PRICE);
92  }

◆ getPriceType()

getPriceType ( )

{Get price type

Returns
int
}

Implements LinkInterface.

Definition at line 97 of file Link.php.

98  {
99  return $this->getData(self::KEY_PRICE_TYPE);
100  }

◆ getQty()

getQty ( )

{Get qty

Returns
float|null
}

Implements LinkInterface.

Definition at line 65 of file Link.php.

66  {
67  return $this->getData(self::KEY_QTY);
68  }

◆ getSku()

getSku ( )

{Get linked product sku

Returns
string|null
}

Implements LinkInterface.

Definition at line 49 of file Link.php.

50  {
51  return $this->getData(self::KEY_SKU);
52  }

◆ setCanChangeQuantity()

setCanChangeQuantity (   $canChangeQuantity)

Set whether quantity could be changed

Parameters
int$canChangeQuantity
Returns
$this

Implements LinkInterface.

Definition at line 193 of file Link.php.

194  {
195  return $this->setData(self::KEY_CAN_CHANGE_QUANTITY, $canChangeQuantity);
196  }

◆ setExtensionAttributes()

setExtensionAttributes ( \Magento\Bundle\Api\Data\LinkExtensionInterface  $extensionAttributes)

{Set an extension attributes object.

Parameters
\Magento\Bundle\Api\Data\LinkExtensionInterface$extensionAttributes
Returns
$this
}

Parameters
\Magento\Bundle\Api\Data\LinkExtensionInterface$extensionAttributes
Returns
$this

Implements LinkInterface.

Definition at line 214 of file Link.php.

215  {
217  }
_setExtensionAttributes(\Magento\Framework\Api\ExtensionAttributesInterface $extensionAttributes)

◆ setId()

setId (   $id)

{Set id

Parameters
string$id
Returns
$this
}

Implements LinkInterface.

Definition at line 41 of file Link.php.

42  {
43  return $this->setData(self::KEY_ID, $id);
44  }
$id
Definition: fieldset.phtml:14

◆ setIsDefault()

setIsDefault (   $isDefault)

Set is default

Parameters
bool$isDefault
Returns
$this

Implements LinkInterface.

Definition at line 160 of file Link.php.

161  {
162  return $this->setData(self::KEY_IS_DEFAULT, $isDefault);
163  }

◆ setOptionId()

setOptionId (   $optionId)

Set option id

Parameters
int$optionId
Returns
$this

Implements LinkInterface.

Definition at line 127 of file Link.php.

128  {
129  return $this->setData(self::KEY_OPTION_ID, $optionId);
130  }

◆ setPosition()

setPosition (   $position)

Set position

Parameters
int$position
Returns
$this

Implements LinkInterface.

Definition at line 149 of file Link.php.

150  {
151  return $this->setData(self::KEY_POSITION, $position);
152  }

◆ setPrice()

setPrice (   $price)

Set price

Parameters
float$price
Returns
$this

Implements LinkInterface.

Definition at line 171 of file Link.php.

172  {
173  return $this->setData(self::KEY_PRICE, $price);
174  }
$price

◆ setPriceType()

setPriceType (   $priceType)

Set price type

Parameters
int$priceType
Returns
$this

Implements LinkInterface.

Definition at line 182 of file Link.php.

183  {
184  return $this->setData(self::KEY_PRICE_TYPE, $priceType);
185  }
$priceType
Definition: msrp.phtml:18

◆ setQty()

setQty (   $qty)

Set qty

Parameters
float$qty
Returns
$this

Implements LinkInterface.

Definition at line 138 of file Link.php.

139  {
140  return $this->setData(self::KEY_QTY, $qty);
141  }

◆ setSku()

setSku (   $sku)

Set linked product sku

Parameters
string$sku
Returns
$this

Implements LinkInterface.

Definition at line 116 of file Link.php.

117  {
118  return $this->setData(self::KEY_SKU, $sku);
119  }

Field Documentation

◆ KEY_CAN_CHANGE_QUANTITY

const KEY_CAN_CHANGE_QUANTITY = 'selection_can_change_quantity'

Definition at line 27 of file Link.php.

◆ KEY_ID

const KEY_ID = 'id'

#+ Constants

Definition at line 19 of file Link.php.

◆ KEY_IS_DEFAULT

const KEY_IS_DEFAULT = 'is_default'

Definition at line 24 of file Link.php.

◆ KEY_OPTION_ID

const KEY_OPTION_ID = 'option_id'

Definition at line 21 of file Link.php.

◆ KEY_POSITION

const KEY_POSITION = 'position'

Definition at line 23 of file Link.php.

◆ KEY_PRICE

const KEY_PRICE = 'price'

Definition at line 25 of file Link.php.

◆ KEY_PRICE_TYPE

const KEY_PRICE_TYPE = 'price_type'

Definition at line 26 of file Link.php.

◆ KEY_QTY

const KEY_QTY = 'qty'

Definition at line 22 of file Link.php.

◆ KEY_SKU

const KEY_SKU = 'sku'

Definition at line 20 of file Link.php.


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