本文整理匯總了PHP中Magento\Framework\Model\AbstractModel::save方法的典型用法代碼示例。如果您正苦於以下問題:PHP AbstractModel::save方法的具體用法?PHP AbstractModel::save怎麽用?PHP AbstractModel::save使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Magento\Framework\Model\AbstractModel
的用法示例。
在下文中一共展示了AbstractModel::save方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: saveTestData
/**
* Saving test data to database
* @return mixed
*/
protected function saveTestData()
{
foreach ($this->getTestData() as $key => $value) {
$this->model->setData($key, $value);
}
$this->model->save();
return $this->model->getId();
}
示例2: save
/**
* @return $this
*/
public function save()
{
if (!is_null($this->getId()) && $this->isCacheEnabled()) {
$this->getHelper('Data\\Cache\\Permanent')->removeTagValues($this->getCacheInstancesTag());
}
return parent::save();
}
示例3: df_eav_partial_save
/**
* 2016-08-22
* @param AbstractModel $model
* @return void
*/
function df_eav_partial_save(AbstractModel $model)
{
/** @var AbstractEntity $resource */
$resource = $model->getResource();
$resource->isPartialSave(true);
try {
$model->save();
} finally {
$resource->isPartialSave(false);
}
}
示例4: _testUpdate
protected function _testUpdate()
{
foreach ($this->_updateData as $key => $value) {
$this->_model->setDataUsingMethod($key, $value);
}
$this->_model->save();
$model = $this->_getEmptyModel();
$model->load($this->_model->getId());
foreach ($this->_updateData as $key => $value) {
\PHPUnit_Framework_Assert::assertEquals($value, $model->getDataUsingMethod($key), 'CRUD Update "' . $key . '" error');
}
}
示例5: save
/**
* Save model plus its options
* Ensures saving options in case when resource model was not changed
*
* @return void
*/
public function save()
{
$hasDataChanges = $this->hasDataChanges();
$this->_flagOptionsSaved = false;
parent::save();
if ($hasDataChanges && !$this->_flagOptionsSaved) {
$this->_saveItemOptions();
}
}
示例6: save
/**
* Save quote with prevention checking
*
* @return $this
*/
public function save()
{
if ($this->_preventSaving) {
return $this;
}
return parent::save();
}
示例7: save
/**
* Save wishlist.
*
* @return $this
*/
public function save()
{
$this->_hasDataChanges = true;
return parent::save();
}
示例8: save
/**
* Set `updated_at` to be always changed
*
* @return $this
*/
public function save()
{
$this->setUpdatedAt(gmdate('Y-m-d H:i:s'));
return parent::save();
}
示例9: save
/**
* Save mail to db, message and attachments to storage
*
* @throws \Magento\Framework\Exception\MailException
* @throws \Exception
*/
public function save()
{
parent::save();
$this->_storage->saveMessage($this);
$this->_storage->saveAttachments($this);
$this->_storage->saveMail($this);
}