本文整理汇总了PHP中BaseActiveRecordVersioned::save方法的典型用法代码示例。如果您正苦于以下问题:PHP BaseActiveRecordVersioned::save方法的具体用法?PHP BaseActiveRecordVersioned::save怎么用?PHP BaseActiveRecordVersioned::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseActiveRecordVersioned
的用法示例。
在下文中一共展示了BaseActiveRecordVersioned::save方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
public function save($runValidation = true, $attributes = null, $allow_overriding = false, $save_version = false)
{
$previous = Episode::model()->findByPk($this->id);
if (parent::save($runValidation, $attributes, $allow_overriding, $save_version)) {
if ($previous && $previous->episode_status_id != $this->episode_status_id) {
$this->audit('episode', 'change-status', $this->episode_status_id);
}
return true;
}
return false;
}
示例2: save
/**
* Saves or updates a db record and creates the salt for a new record of
* authentication type 'basic'.
*
* @return bool
*/
public function save($runValidation = true, $attributes = null, $allow_overriding = false, $save_archive = false)
{
if (Yii::app()->params['auth_source'] == 'BASIC') {
/*
* AUTH_BASIC requires creation of a salt. AUTH_LDAP doesn't.
*/
if ($this->getIsNewRecord() && !$this->salt) {
$salt = '';
$possible = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
for ($i = 0; $i < 10; ++$i) {
$salt .= $possible[mt_rand(0, strlen($possible) - 1)];
}
$this->salt = $salt;
}
}
return parent::save($runValidation, $attributes, $allow_overriding, $save_archive);
}