本文整理汇总了PHP中RedBeanModel::save方法的典型用法代码示例。如果您正苦于以下问题:PHP RedBeanModel::save方法的具体用法?PHP RedBeanModel::save怎么用?PHP RedBeanModel::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RedBeanModel
的用法示例。
在下文中一共展示了RedBeanModel::save方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
/**
* Any changes to the model must be re-cached.
* @see RedBeanModel::save()
*/
public function save($runValidation = true, array $attributeNames = null)
{
$saved = parent::save($runValidation, $attributeNames);
if ($saved) {
GeneralCache::cacheEntry('CustomFieldData' . $this->name, $this);
}
return $saved;
}
示例2: processCreateAction
protected function processCreateAction()
{
if ($this->resolveCreateModel($this->triggeredModel, $this->action->relation) && $this->canSaveTriggeredModel) {
$saved = $this->triggeredModel->save();
if (!$saved) {
throw new FailedToSaveModelException();
}
}
}
示例3: processAfterCopy
public static function processAfterCopy(RedBeanModel $model, RedBeanModel $copyToModel)
{
foreach ($model->tasks as $task) {
$copyToTask = new Task();
TaskActivityCopyModelUtil::copy($task, $copyToTask);
$copyToTask->status = Task::STATUS_NEW;
$copyToModel->tasks->add($copyToTask);
}
$copyToModel->save();
}
示例4: unrestrictedSave
public function unrestrictedSave($runValidation = true, array $attributeNames = null)
{
return parent::save($runValidation, $attributeNames);
}
示例5: saveAndReloadModel
public static function saveAndReloadModel(RedBeanModel $model)
{
$saved = $model->save();
if (!$saved) {
throw new FailedToSaveModelException();
}
$modelId = $model->id;
$modelClassName = get_class($model);
$model->forget();
unset($model);
return $modelClassName::getById($modelId);
}
示例6: save
/**
* Override to resetCache after a currency is saved.
* (non-PHPdoc)
* @see RedBeanModel::save()
*/
public function save($runValidation = true, array $attributeNames = null)
{
$saved = parent::save($runValidation, $attributeNames);
self::resetCaches();
return $saved;
}
示例7: refreshModel
protected static function refreshModel(RedBeanModel &$model)
{
assert('$model->id > 0');
// this is just a fail safe. We don't want to lose any unsaved changes.
// ideally $model should be saved by this point anyway, but regardless:
if ($model->isModified() && !$model->save()) {
throw new FailedToSaveModelException();
}
$modelId = $model->id;
$modelClass = get_class($model);
$model->forgetAll();
$model = $modelClass::getById($modelId);
}