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


PHP ActiveRecord::beforeSave方法代码示例

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


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

示例1: beforeSave

 public function beforeSave()
 {
     if ($this->id === self::LEVEL_ENGINEER) {
         $this->banned_resources_inheritance = NULL;
     }
     return parent::beforeSave();
 }
开发者ID:jacjimus,项目名称:furahia_mis,代码行数:7,代码来源:UserLevels.php

示例2: beforeSave

 /**
  * Before save operations
  */
 public function beforeSave()
 {
     if ($this->isNewRecord) {
         $this->user_id = Yii::app()->user->id;
     }
     return parent::beforeSave();
 }
开发者ID:YiiCoded,项目名称:yii-ecommerce,代码行数:10,代码来源:PersonalMessageReply.php

示例3: beforeSave

 public function beforeSave()
 {
     if ($this->isNewRecord) {
         $this->user_id = user()->getId();
     }
     return parent::beforeSave();
 }
开发者ID:mmorpg2015,项目名称:ghtweb5,代码行数:7,代码来源:TicketsAnswers.php

示例4: beforeSave

 public function beforeSave()
 {
     if (!empty($this->id)) {
         $this->setProfileImage();
     }
     return parent::beforeSave();
 }
开发者ID:jacjimus,项目名称:furahia_mis,代码行数:7,代码来源:Person.php

示例5: beforeSave

 function beforeSave()
 {
     parent::beforeSave();
     if ($this->validate()) {
         $this->password = $this->hashPassword($this->password);
     }
     return true;
 }
开发者ID:hiproz,项目名称:mincms,代码行数:8,代码来源:User.php

示例6: beforeSave

 protected function beforeSave()
 {
     if ($this->getIsNewRecord()) {
         $this->ip = userIp();
         $this->user_agent = request()->getUserAgent();
     }
     return parent::beforeSave();
 }
开发者ID:mmorpg2015,项目名称:ghtweb5,代码行数:8,代码来源:UsersAuthLogs.php

示例7: beforeSave

 public function beforeSave()
 {
     $scoord = explode(',', $this->start_coords);
     $this->start_coords = new CDbExpression("GeomFromText(:start_point)", array(':start_point' => 'POINT(' . $scoord[0] . ' ' . $scoord[1] . ')'));
     $ecoord = explode(',', $this->end_coords);
     $this->end_coords = new CDbExpression("GeomFromText(:end_point)", array(':end_point' => 'POINT(' . $ecoord[0] . ' ' . $ecoord[1] . ')'));
     return parent::beforeSave();
 }
开发者ID:buildshop,项目名称:bs-common,代码行数:8,代码来源:ContactsRouter.php

示例8: beforeSave

 /**
  *  Asignando anho y id del ente organo al cual pertenece el usuario.
  */
 public function beforeSave()
 {
     if ($this->isNewRecord) {
         $this->anho = 2015;
         $this->ente_organo_id = Usuarios::model()->findByPk(Yii::app()->user->getId())->enteOrgano->ente_organo_id;
     }
     return parent::beforeSave();
 }
开发者ID:EurekaSolutions,项目名称:sistemanc,代码行数:11,代码来源:Procedimientos.php

示例9: beforeSave

 protected function beforeSave()
 {
     if ($this->isNewRecord) {
         $this->referer = self::generateRefererCode();
         $this->registration_ip = userIp();
     }
     return parent::beforeSave();
 }
开发者ID:mmorpg2015,项目名称:ghtweb5,代码行数:8,代码来源:Users.php

示例10: beforeSave

 /**
  *  Asignando anho y id del ente organo al cual pertenece el usuario.
  */
 public function beforeSave()
 {
     if ($this->isNewRecord) {
         $this->anho = Yii::app()->params['trimestresFechas'][Yii::app()->session['trimestreSeleccionado']]['anho'];
         $this->ente_organo_id = Usuarios::model()->findByPk(Yii::app()->user->getId())->enteOrgano->ente_organo_id;
     }
     return parent::beforeSave();
 }
开发者ID:EurekaSolutions,项目名称:sistemanc,代码行数:11,代码来源:Facturas.php

示例11: beforeSave

 /**
  * Обработка данных перед сохранением
  */
 protected function beforeSave()
 {
     if ($this->isNewRecord) {
         if (is_numeric(user()->getId())) {
             $this->user_id = user()->getId();
         }
     }
     return parent::beforeSave();
 }
开发者ID:mmorpg2015,项目名称:ghtweb5,代码行数:12,代码来源:News.php

示例12: beforeSave

 public function beforeSave($insert)
 {
     if (parent::beforeSave($insert)) {
         $this->created_at = time();
         return true;
     } else {
         return false;
     }
 }
开发者ID:glcode,项目名称:yii2-2.0.3-annotated,代码行数:9,代码来源:Order.php

示例13: beforeSave

 public function beforeSave()
 {
     if ($this->getIsNewRecord()) {
         if (empty($this->from_user_id)) {
             $this->from_user_id = Yii::app()->user->id;
         }
     }
     return parent::beforeSave();
 }
开发者ID:wanyos2005,项目名称:hsbf,代码行数:9,代码来源:MsgMessage.php

示例14: beforeSave

 /**
  * Before save operations
  */
 public function beforeSave()
 {
     // Check to make sure the theme dir is writeable
     $path = Yii::getPathOfAlias('application.www.themes');
     if (!is_writeable($path)) {
         $this->addError('dirname', at('Sorry, We could not create the theme directory as the theme path "{d}" is not writeable. Please set the appropriate permissions.', array('{d}' => $path)));
         return;
     }
     return parent::beforeSave();
 }
开发者ID:YiiCoded,项目名称:yii-ecommerce,代码行数:13,代码来源:Theme.php

示例15: beforeSave

 protected function beforeSave()
 {
     if ($this->protected_ip) {
         $ipList = str_replace(array("\r"), '', $this->protected_ip);
         $ipList = explode("\n", $ipList);
         $ipList = array_map('trim', $ipList);
         $this->protected_ip = json_encode($ipList);
     }
     return parent::beforeSave();
 }
开发者ID:mmorpg2015,项目名称:ghtweb5,代码行数:10,代码来源:UserProfiles.php


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