當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。