Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Attributes
Value Class Reference
Inheritance diagram for Value:
AbstractModel ValueInterface DataObject CollectionTime Enabled Vertical BackendModel Cron CountryCreditCard AbstractForm Category Image Mode Mode PriceScope Suffix AbstractValue Minqty Minsaleqty Qtyincrements Engine Custom Custompath Expirationperiod Robots Usecustom Usesecretkey Baseurl Cache AbstractCurrency Cron Datashare Address Sender Encrypted File Filename Adapter Locale Timezone Cron Secure Serialized Store Translate Cookie Domain Lifetime Path Alert Sitemap Street DisableAutoGroupAssignDefault Expirationperiod Customer Share AllowedIps WorkflowType AbstractConversion Database Tablerate Ttl Varnish Cert Cron MerchantCountry Value Links AsyncSending AsyncIndexing Priority Robots Notification IncludePrice TaxClass Theme

Public Member Functions

 __construct (\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\App\Config\ScopeConfigInterface $config, \Magento\Framework\App\Cache\TypeListInterface $cacheTypeList, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[])
 
 isValueChanged ()
 
 getOldValue ()
 
 getFieldsetDataValue ($key)
 
 afterSave ()
 
 afterDelete ()
 
- 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)
 

Protected Attributes

 $_eventPrefix = 'config_data'
 
 $_eventObject = 'config_data'
 
 $_config
 
 $cacheTypeList
 
- 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 = []
 

Additional Inherited Members

- Data Fields inherited from ValueInterface
const ENTITY = 'config_data'
 
- 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)
 
- Static Protected Attributes inherited from DataObject
static $_underscoreCache = []
 

Detailed Description

Config data model

This model is temporarily marked as API since {

See also
\Magento\Framework\App\Config\ValueInterface} doesn't fit developers' needs of extensibility. In 2.4 we are going to introduce a new interface which should cover all needs and deprecate the mentioned together with the model

@method string getScope() @method \Magento\Framework\App\Config\ValueInterface setScope(string $value) @method int getScopeId() @method \Magento\Framework\App\Config\ValueInterface setScopeId(int $value) @method string getPath() @method \Magento\Framework\App\Config\ValueInterface setPath(string $value) @method string getValue() @method \Magento\Framework\App\Config\ValueInterface setValue(string $value)

@api

@SuppressWarnings(PHPMD.NumberOfChildren)

Definition at line 28 of file Value.php.

Constructor & Destructor Documentation

◆ __construct()

Parameters
\Magento\Framework\Model\Context$context
\Magento\Framework\Registry$registry
ScopeConfigInterface$config
\Magento\Framework\App\Cache\TypeListInterface$cacheTypeList
\Magento\Framework\Model\ResourceModel\AbstractResource | null$resource
\Magento\Framework\Data\Collection\AbstractDb | null$resourceCollection
array$data

Definition at line 65 of file Value.php.

73  {
74  $this->_config = $config;
75  $this->cacheTypeList = $cacheTypeList;
76  parent::__construct($context, $registry, $resource, $resourceCollection, $data);
77  }
$config
Definition: fraud_order.php:17
$resource
Definition: bulk.php:12

Member Function Documentation

◆ afterDelete()

afterDelete ( )

Processing object after delete data

{}. In addition, it sets status 'invalidate' for config caches

Returns
$this

Definition at line 138 of file Value.php.

139  {
140  $this->cacheTypeList->invalidate(\Magento\Framework\App\Cache\Type\Config::TYPE_IDENTIFIER);
141 
142  return parent::afterDelete();
143  }

◆ afterSave()

afterSave ( )

Processing object after save data

{}. In addition, it sets status 'invalidate' for config caches

Returns
$this

Definition at line 122 of file Value.php.

123  {
124  if ($this->isValueChanged()) {
125  $this->cacheTypeList->invalidate(\Magento\Framework\App\Cache\Type\Config::TYPE_IDENTIFIER);
126  }
127 
128  return parent::afterSave();
129  }

◆ getFieldsetDataValue()

getFieldsetDataValue (   $key)

Get value by key for new user data from <section>/groups/<group>/fields/<field>

Parameters
string$key
Returns
string

Implements ValueInterface.

Definition at line 109 of file Value.php.

110  {
111  $data = $this->_getData('fieldset_data');
112  return is_array($data) && isset($data[$key]) ? $data[$key] : null;
113  }

◆ getOldValue()

getOldValue ( )

Get old value from existing config

Returns
string

Implements ValueInterface.

Definition at line 94 of file Value.php.

95  {
96  return (string)$this->_config->getValue(
97  $this->getPath(),
98  $this->getScope() ?: ScopeConfigInterface::SCOPE_TYPE_DEFAULT,
99  $this->getScopeCode()
100  );
101  }

◆ isValueChanged()

isValueChanged ( )

Check if config data value was changed

Returns
bool

Implements ValueInterface.

Definition at line 84 of file Value.php.

85  {
86  return $this->getValue() != $this->getOldValue();
87  }
getValue( $path=null, $scope=ScopeConfigInterface::SCOPE_TYPE_DEFAULT, $scopeCode=null)
Definition: Config.php:56

Field Documentation

◆ $_config

$_config
protected

Definition at line 49 of file Value.php.

◆ $_eventObject

$_eventObject = 'config_data'
protected

Definition at line 44 of file Value.php.

◆ $_eventPrefix

$_eventPrefix = 'config_data'
protected

Definition at line 35 of file Value.php.

◆ $cacheTypeList

$cacheTypeList
protected

Definition at line 54 of file Value.php.


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