当前位置: 首页>>代码示例>>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;未经允许,请勿转载。