18 class Flag extends Model\AbstractModel
54 \
Magento\Framework\Data\Collection\AbstractDb $resourceCollection =
null,
80 if ($this->
hasData(
'flag_code')) {
81 $this->_flagCode = $this->
getData(
'flag_code');
94 if ($this->_flagCode ===
null) {
95 throw new Exception\LocalizedException(
new \
Magento\Framework\
Phrase(
'Please define flag code.'));
98 $this->setFlagCode($this->_flagCode);
99 if (!$this->hasKeepUpdateDate()) {
100 $this->setLastUpdate(date(
'Y-m-d H:i:s'));
103 return parent::beforeSave();
113 if ($this->hasFlagData()) {
114 $flagData = $this->
getData(
'flag_data');
116 $data = $this->json->unserialize($flagData);
117 }
catch (\InvalidArgumentException $exception) {
132 return $this->
setData(
'flag_data', $this->json->serialize(
$value));
143 if ($this->_flagCode ===
null) {
144 throw new Exception\LocalizedException(
new \
Magento\Framework\
Phrase(
'Please define flag code.'));
147 return $this->
load($this->_flagCode,
'flag_code');
setData($key, $value=null)
getData($key='', $index=null)
load($modelId, $field=null)
__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=[], \Magento\Framework\Serialize\Serializer\Json $json=null, \Magento\Framework\Serialize\Serializer\Serialize $serialize=null)
serialize($keys=[], $valueSeparator='=', $fieldSeparator=' ', $quote='"')