本文整理匯總了PHP中app\models\BaseModel::beforeSave方法的典型用法代碼示例。如果您正苦於以下問題:PHP BaseModel::beforeSave方法的具體用法?PHP BaseModel::beforeSave怎麽用?PHP BaseModel::beforeSave使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類app\models\BaseModel
的用法示例。
在下文中一共展示了BaseModel::beforeSave方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: beforeSave
public function beforeSave($insert)
{
if (empty($this->parent)) {
$this->parent = 0;
}
return parent::beforeSave($insert);
}
示例2: beforeSave
public function beforeSave($insert)
{
parent::beforeSave($insert);
$this->url_code = \app\common\XUtils::shorturl($this->url);
$this->description = \app\common\XUtils::ihtmlspecialchars($this->description);
!$this->id && ($this->createtime = time());
$this->updatetime = time();
return true;
}
示例3: beforeSave
/**
* This is invoked before the record is saved.
* @return boolean whether the record should be saved.
*/
public function beforeSave($insert)
{
if (parent::beforeSave($insert)) {
if ($this->isNewRecord) {
$this->create_time = date("Y-m-d H:i:s", time());
$this->author_id = Yii::$app->user->id;
}
return true;
} else {
return false;
}
}
示例4: beforeSave
/**
* 入庫前自動處理
*/
public function beforeSave($insert)
{
parent::beforeSave($insert);
if (trim($this->password)) {
$this->password = md5($this->password);
}
if (!$this->id) {
$this->create_time = time();
$this->last_login_time = time();
}
return true;
}
示例5: beforeSave
public function beforeSave()
{
$this->aBeforeSave();
$this->tsBeforeSave();
parent::beforeSave();
}