本文整理汇总了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);
}