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


PHP CActiveRecord::__set方法代码示例

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


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

示例1: __set

 public function __set($name, $value)
 {
     if (array_key_exists($name, $this->_langAttributes)) {
         $this->_langAttributes[$name] = $value;
     } else {
         parent::__set($name, $value);
     }
 }
开发者ID:jasonhai,项目名称:onehome,代码行数:8,代码来源:MultilingualActiveRecord.php

示例2: __set

 public function __set($name, $value)
 {
     if ($name === 'password') {
         $value = CPasswordHelper::hashPassword($value);
     }
     parent::__set($name, $value);
     // TODO: Change the autogenerated stub
 }
开发者ID:yakleg,项目名称:gosbroker,代码行数:8,代码来源:User.php

示例3: __set

 public function __set($name, $value)
 {
     if (isset($this->_fieldsArias[$name])) {
         parent::__set($this->_fieldsArias[$name], $value);
     } else {
         parent::__set($name, $value);
     }
 }
开发者ID:zwq,项目名称:unpei,代码行数:8,代码来源:TActiveRecord.php

示例4: __set

 /**
  * PHP setter magic method.
  * This method is overridden so that AR attributes can be accessed like properties.
  * @param string $name property name
  * @param mixed $value property value
  */
 public function __set($name, $value)
 {
     $setter = 'set' . ucfirst($name);
     if (method_exists($this, $setter)) {
         return $this->{$setter}($value);
     }
     parent::__set($name, $value);
 }
开发者ID:JoaquinWaldrop,项目名称:globo_tech,代码行数:14,代码来源:AweActiveRecord.php

示例5: __set

 /**
  * 复杂类型字段赋值实现
  */
 public function __set($name, $value)
 {
     if (in_array($name, $this->complexAttributes())) {
         $value = CJSON::encode($value);
         parent::__set($name, $value);
     } else {
         parent::__set($name, $value);
     }
 }
开发者ID:Renbaozhan,项目名称:ecar,代码行数:12,代码来源:RActiveRecord.php

示例6: __set

 public function __set($name, $value)
 {
     $upper = strtoupper($name);
     if ($this->hasAttribute($upper) || $this->hasRelated($upper)) {
         return parent::__set($upper, $value);
     } else {
         return parent::__set($name, $value);
     }
 }
开发者ID:nurirahmat,项目名称:Yii-Extensions,代码行数:9,代码来源:ActiveRecord.php

示例7: __set

 public function __set($name, $value)
 {
     $e;
     try {
         return parent::__set($name, $value);
     } catch (\Exception $ex) {
         $e = $ex;
     }
     $this->dataStore[$name] = $value;
 }
开发者ID:sam-it,项目名称:yii1-translate,代码行数:10,代码来源:Translation.php

示例8: __set

 public function __set($name, $value)
 {
     try {
         parent::__set($name, $value);
         if ($name === 'eav_set_id') {
             $this->refreshEavAttributes();
         }
     } catch (CException $ex) {
         if ($this->setEavAttribute($name, $value) === false) {
             throw $ex;
         }
     }
 }
开发者ID:kuzmina-mariya,项目名称:unizaro-spa,代码行数:13,代码来源:EavActiveRecord.php

示例9: __set

 public function __set($name, $val)
 {
     try {
         return parent::__set($name, $val);
     } catch (CException $e) {
         $method_name = StringHelper::underscoreToCamelcase($name);
         $method_name = 'set' . ucfirst($method_name);
         if (method_exists($this, $method_name)) {
             return $this->{$method_name}($val);
         } else {
             throw new CException($e->getMessage());
         }
     }
 }
开发者ID:nizsheanez,项目名称:alp.ru,代码行数:14,代码来源:ActiveRecordModel.php

示例10: __set

 /**
  * If an array of arrays is passed for a HAS_MANY relation attribute, will create appropriate objects
  * to assign to the attribute. Sets up the afterSave method to saves these objects if they have validated.
  *
  * NOTE once a property is set, this magic method will not be called by php for setting it again, unless the property
  * is unset first.
  *
  * @param string $name
  * @param mixed $value
  * @throws Exception
  * @return mixed|void
  */
 public function __set($name, $value)
 {
     // Only perform this override if turned on for the given model
     if ($this->auto_update_relations && is_array($value) && count($value) && isset($this->getMetaData()->relations[$name])) {
         $rel = $this->getMetaData()->relations[$name];
         $cls = get_class($rel);
         if ($cls == self::HAS_MANY || $cls == self::MANY_MANY) {
             $rel_cls = $rel->className;
             $pk_attr = $rel_cls::model()->getMetaData()->tableSchema->primaryKey;
             // not supporting composite primary keys at this point
             if (is_string($pk_attr)) {
                 $m_set = array();
                 foreach ($value as $v) {
                     if (is_array($v)) {
                         // looks like a list of attribute values, try to find or instantiate the classes
                         if (array_key_exists($pk_attr, $v) && isset($v[$pk_attr])) {
                             $m = $rel_cls::model()->findByPk($v[$pk_attr]);
                         } else {
                             $m = new $rel_cls();
                         }
                         $m->attributes = array_merge($this->getRelationsDefaults($name), $v);
                         // set foreign key on the related object
                         $m->{$rel->foreignKey} = $this->getPrimaryKey();
                     } elseif (is_object($v)) {
                         $m = $v;
                     } else {
                         // try to find the instance
                         if (!($m = $rel_cls::model()->findByPk($v))) {
                             throw new Exception("Unable to understand value " . print_r($v, true) . " for {$name}");
                         }
                     }
                     $m_set[] = $m;
                 }
                 // reset the value for it to be set by parent method
                 $value = $m_set;
             }
         }
     }
     parent::__set($name, $value);
 }
开发者ID:openeyeswales,项目名称:OpenEyes,代码行数:52,代码来源:BaseActiveRecord.php

示例11: __set

 public function __set($name, $value)
 {
     $this->initRelation();
     switch (true) {
         case Helper::isLastString($name, 'PageSize'):
             $name = substr_replace($name, '', -8);
             $this->__pageSize[$name] = $value;
             break;
         case Helper::isLastString($name, 'Insert'):
             $name = substr_replace($name, '', -6);
             if (isset($this->__relations[$name])) {
                 $this->__relInsert[$name] = $value;
             }
             break;
         case Helper::isLastString($name, 'Update'):
             $name = substr_replace($name, '', -6);
             if (isset($this->__relations[$name])) {
                 $this->__relUpdate[$name] = $value;
             }
             break;
         case Helper::isLastString($name, 'Delete'):
             $name = substr_replace($name, '', -6);
             if (isset($this->__relations[$name])) {
                 $this->__relDelete[$name] = $value;
             }
             break;
         case isset($this->__relations[$name]):
             $this->__relations[$name] = $value;
             break;
         default:
             try {
                 parent::__set($name, $value);
             } catch (Exception $e) {
                 $this->__tempVar[$name] = $value;
             }
             break;
     }
 }
开发者ID:rizabudi,项目名称:plansys,代码行数:38,代码来源:ActiveRecord.php

示例12: __set

 public function __set($name, $value)
 {
     if ($name === 'attributes') {
         foreach ($value as $key => $val) {
             if (strpos($key, '.') !== false) {
                 $parts = explode('.', $key);
                 $relation = $this->getActiveRelation($parts[0]);
                 $className = $relation->className;
                 $model = new $className();
                 if ($model->hasAttribute($parts[1]) || $model->hasProperty($parts[1])) {
                     $this->Search[$parts[0]][$parts[1]] = $val;
                 }
             }
         }
     }
     parent::__set($name, $value);
 }
开发者ID:snapfrozen,项目名称:snapcms,代码行数:17,代码来源:SnapActiveRecord.php

示例13: __set

 public function __set($name, $value)
 {
     $flags = $this->cachedFlags();
     if (strncasecmp($name, $this->namePrefix, 2) === 0) {
         $name = substr(strtolower($name), strlen($this->namePrefix));
         if (isset($flags[$name])) {
             $this->setFlag($flags[$name], $value);
         }
     } else {
         parent::__set($name, $value);
     }
 }
开发者ID:fduch2k,项目名称:yii-flagged-activerecord,代码行数:12,代码来源:TSFlaggedActiveRecord.php

示例14: __set

 public function __set($name, $value)
 {
     $isSerialized = $this->isSerializedAttr($name);
     if ($isSerialized) {
         $this->getData()->{$name} = $value;
     } else {
         parent::__set($name, $value);
     }
 }
开发者ID:vasiliy-pdk,项目名称:aes,代码行数:9,代码来源:PersonIdentifier.php

示例15: __set

 /**
  * @see CActiveRecord::__set()
  */
 public function __set($name, $value)
 {
     if ($this->getAttribute($name) == $value) {
         return;
     }
     parent::__set($name, $value);
     if (!$this->getIsNewRecord() && $this->hasAttribute($name)) {
         $this->_dirtykeys[] = $name;
         $this->_isdirty = true;
     }
 }
开发者ID:njxjxj,项目名称:yorm,代码行数:14,代码来源:CEntity.php


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