当前位置: 首页>>代码示例>>PHP>>正文


PHP EMongoDocument::beforeSave方法代码示例

本文整理汇总了PHP中EMongoDocument::beforeSave方法的典型用法代码示例。如果您正苦于以下问题:PHP EMongoDocument::beforeSave方法的具体用法?PHP EMongoDocument::beforeSave怎么用?PHP EMongoDocument::beforeSave使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EMongoDocument的用法示例。


在下文中一共展示了EMongoDocument::beforeSave方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: beforeSave

 protected function beforeSave()
 {
     if (parent::beforeSave()) {
         if ($this->isNewRecord) {
             $this->id = $this->getAutoIncreaseId(false);
         }
         if (isset($this['last_uid'])) {
             $this->last_uid = Yii::app()->user->id;
             //添加操作者
         }
         if (isset($this['update_time'])) {
             $this->update_time = time();
         }
         return true;
     } else {
         return false;
     }
 }
开发者ID:chenyongze,项目名称:d-a-m,代码行数:18,代码来源:DBModel.php

示例2: beforeSave

 /**
  * Метод для приведения типов перед сохранением в MongoDB
  */
 protected function beforeSave()
 {
     if (parent::beforeSave()) {
         $arrayType = $this->returnArrayType();
         foreach ($arrayType as $name => $type) {
             switch ($type) {
                 case 'integer':
                     $this->{$name} = intval($this->{$name});
                     break;
                 case 'float':
                     $this->{$name} = floatval($this->{$name});
                     break;
                 case 'boolean':
                     $this->{$name} = (bool) $this->{$name};
                     break;
             }
         }
         return true;
     } else {
         return false;
     }
 }
开发者ID:kalyashov-work,项目名称:modules,代码行数:25,代码来源:MenuLinks.php

示例3: beforeSave

 public function beforeSave()
 {
     if (Yii::app()->controller->action->id == "subscribe") {
         if (in_array("neuropathologiste", $this->profil) || in_array("geneticien", $this->profil) || in_array("chercheur", $this->profil)) {
             $this->profil = [];
         }
     }
     return parent::beforeSave();
 }
开发者ID:Biobanques,项目名称:cbsd_platform,代码行数:9,代码来源:User.php

示例4: beforeSave

 protected function beforeSave()
 {
     if (parent::beforeSave()) {
         if (empty($this->itemid)) {
             $this->itemid = md5(uniqid());
         }
         if (empty($this->url)) {
             $this->url = '#';
         }
         if (!isset($this->active)) {
             $this->active = false;
         }
         if (!isset($this->visible)) {
             $this->visible = true;
         }
         if (!isset($this->descriptionashint)) {
             $this->descriptionashint = true;
         }
         if (!isset($this->labels)) {
             $this->labels = $this->asa('attributesBehavior')->initLanguageAttribute('labels');
         }
         if (!isset($this->descriptions)) {
             $this->descriptions = $this->asa('attributesBehavior')->initLanguageAttribute('descriptions');
         }
         return true;
     } else {
         return false;
     }
 }
开发者ID:prayagKhanal,项目名称:menubuilder,代码行数:29,代码来源:EMBMongoDbMenuItem.php

示例5: beforeSave

 protected function beforeSave()
 {
     if (parent::beforeSave()) {
         if (empty($this->menuid)) {
             return false;
         }
         if (!isset($this->visible)) {
             $this->visible = true;
         }
         if (!isset($this->descriptionashint)) {
             $this->descriptionashint = true;
         }
         if (!isset($this->titles)) {
             $this->titles = $this->asa('attributesBehavior')->initLanguageAttribute('titles');
         }
         if (empty($this->sortposition)) {
             $this->sortposition = 0;
         }
         if (!isset($this->adminroles)) {
             $this->adminroles = '';
         }
         if (is_array($this->adminroles)) {
             $this->adminroles = implode(',', $this->adminroles);
         }
         return true;
     } else {
         return false;
     }
 }
开发者ID:prayagKhanal,项目名称:menubuilder,代码行数:29,代码来源:EMBMongoDbMenu.php


注:本文中的EMongoDocument::beforeSave方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。