當前位置: 首頁>>代碼示例>>PHP>>正文


PHP LSActiveRecord::beforeSave方法代碼示例

本文整理匯總了PHP中LSActiveRecord::beforeSave方法的典型用法代碼示例。如果您正苦於以下問題:PHP LSActiveRecord::beforeSave方法的具體用法?PHP LSActiveRecord::beforeSave怎麽用?PHP LSActiveRecord::beforeSave使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在LSActiveRecord的用法示例。


在下文中一共展示了LSActiveRecord::beforeSave方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: beforeSave

 /**
  * This method is invoked before saving a record (after validation, if any).
  * The default implementation raises the {@link onBeforeSave} event.
  * You may override this method to do any preparation work for record saving.
  * Use {@link isNewRecord} to determine whether the saving is
  * for inserting or updating record.
  * Make sure you call the parent implementation so that the event is raised properly.
  * @return boolean whether the saving should be executed. Defaults to true.
  */
 public function beforeSave()
 {
     if ($this->usesleft > 0) {
         $this->completed = 'N';
     }
     return parent::beforeSave();
 }
開發者ID:rouben,項目名稱:LimeSurvey,代碼行數:16,代碼來源:TokenDynamic.php

示例2: beforeSave

 /**
  * This method is invoked before saving a record (after validation, if any).
  * The default implementation raises the {@link onBeforeSave} event.
  * You may override this method to do any preparation work for record saving.
  * Use {@link isNewRecord} to determine whether the saving is
  * for inserting or updating record.
  * Make sure you call the parent implementation so that the event is raised properly.
  * @return boolean whether the saving should be executed. Defaults to true.
  */
 public function beforeSave()
 {
     // Postgres delivers bytea fields as streams :-o - if this is not done it looks like Postgres saves something unexpected
     if (gettype($this->password) == 'resource') {
         $this->password = stream_get_contents($this->password, -1, 0);
     }
     return parent::beforeSave();
 }
開發者ID:wrenchpilot,項目名稱:LimeSurvey,代碼行數:17,代碼來源:User.php

示例3: beforeSave

 /**
  * Make sure we don't save a new question group
  * while the survey is active.
  *
  * @return bool
  */
 protected function beforeSave()
 {
     if (parent::beforeSave()) {
         $surveyIsActive = Survey::model()->findByPk($this->sid)->active !== 'N';
         if ($surveyIsActive && $this->getIsNewRecord()) {
             return false;
         }
         return true;
     } else {
         return false;
     }
 }
開發者ID:sickpig,項目名稱:LimeSurvey,代碼行數:18,代碼來源:Question.php


注:本文中的LSActiveRecord::beforeSave方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。