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


PHP ActiveRecord::__set方法代码示例

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


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

示例1: __set

 /**
  * @inheritdoc
  */
 public function __set($name, $value)
 {
     if ($this->tryToSetRelation($name, $value)) {
         return;
     }
     parent::__set($name, $value);
 }
开发者ID:yinheark,项目名称:yincart2,代码行数:10,代码来源:ActiveRecord.php

示例2: __set

 public function __set($name, $value)
 {
     if ($name === 'history') {
         return $this->setHistory($value);
     }
     return parent::__set($name, $value);
 }
开发者ID:serhiobb,项目名称:RGK-test,代码行数:7,代码来源:Url.php

示例3: __set

 public function __set($name, $value)
 {
     if (isset($this->_pivotAttributes[$name])) {
         throw new Exception("Attribute '{$name}' is attached from junction table and read-only");
     }
     parent::__set($name, $value);
 }
开发者ID:alexinator1,项目名称:yii2-jta,代码行数:7,代码来源:ActiveRecord.php

示例4: __set

 /**
  * @inheritdoc
  */
 public function __set($name, $newValue)
 {
     if ($this->hasMetaAttribute($name)) {
         $this->setMeta($name, $newValue);
     } else {
         parent::__set($name, $newValue);
     }
 }
开发者ID:NewPaltzKarateAcademy,项目名称:KIMS,代码行数:11,代码来源:MetaModel.php

示例5: __set

 /**
  * @inheritdoc
  */
 public function __set($name, $value)
 {
     if ($this->_i18n_enabled && in_array($name, $this->_getI18NAttributes())) {
         $this->{$name} = $value;
     } else {
         parent::__set($name, $value);
     }
 }
开发者ID:olegantoniuk,项目名称:components,代码行数:11,代码来源:BaseActiveRecord.php

示例6: __set

 public function __set($name, $value)
 {
     if (!in_array($name, $this->attributes()) && !empty($this->app->elements[$name]) && ($behavior = $this->getBehavior($this->app->elements[$name]->type)) !== null) {
         return $behavior->setValue($name, $value);
     } else {
         return parent::__set($name, $value);
     }
 }
开发者ID:worstinme,项目名称:yii2-zoo,代码行数:8,代码来源:Items.php

示例7: __set

 public function __set($name, $value)
 {
     if (in_array($name, $this->jsonParams)) {
         return $this->setJsonParams($name, $value);
     } else {
         return parent::__set($name, $value);
     }
 }
开发者ID:worstinme,项目名称:yii2-z-cart,代码行数:8,代码来源:CartOrders.php

示例8: __set

 public function __set($name, $value)
 {
     try {
         parent::__set($name, $value);
     } catch (UnknownPropertyException $e) {
         if (isset($this->_transformers[$name])) {
             $this->_transformers[$name]->transformTo($value);
         } else {
             parent::__set(static::prop2col($name), $value);
         }
     }
 }
开发者ID:tsyrya,项目名称:mybriop,代码行数:12,代码来源:EntityBase.php

示例9: __set

 /**
  * Override __get of yii\db\ActiveRecord
  *
  * @param string $name the property name or the event name
  * @param mixed $value the property value
  */
 public function __set($name, $value)
 {
     if ($this->hasAttribute($name)) {
         parent::__set($name, $value);
     } else {
         if ($this->autoSaveMetaFields && !$this->isNewRecord) {
             $this->setMetaAttribute($name, $value);
         } else {
             $this->enqueueMetaUpdate($name, $value);
         }
     }
 }
开发者ID:mipotech,项目名称:yii2-meta-activerecord,代码行数:18,代码来源:MetaActiveRecord.php

示例10: __set

 public function __set($name, $value)
 {
     if (in_array($name, $this->getDefaultFields())) {
         return parent::__set($name, $value);
     }
     if (in_array($name, $this->getSkipFields())) {
         return [];
     }
     $rules = Json::decode($this->rules);
     if (!$rules) {
         $rules = [];
     }
     $rules[$name] = $value;
     $this->rules = Json::encode($rules);
 }
开发者ID:mirocow,项目名称:yii2-eav,代码行数:15,代码来源:EavAttributeRule.php

示例11: setAttribute

 /**
  * Sets a model attribute.
  *
  * @param string $name attribute name, use dotted notation for structured attributes.
  * @param mixed $value the attribute value. A value of null effectively unsets the attribute.
  */
 public function setAttribute($name, $value)
 {
     try {
         parent::__set($name, $value);
         return;
     } catch (UnknownPropertyException $ignore) {
     }
     $path = explode('.', $name);
     $ref =& $this->_dynamicAttributes;
     // Walk forwards through $path to find the deepest key already set.
     do {
         $key = $path[0];
         if (isset($ref[$key])) {
             $ref =& $ref[$key];
             array_shift($path);
         } else {
             break;
         }
     } while ($path);
     // If the whole path already existed then we can just set it.
     if (!$path) {
         $ref = $value;
         return;
     }
     // There is remaining path so we have to set a new leaf with the first
     // part of the remaining path as key. But first, if there is any path
     // beyond that then we need build an array to set as the new leaf value.
     while (count($path) > 1) {
         $key = array_pop($path);
         $value = [$key => $value];
     }
     $ref[$path[0]] = $value;
 }
开发者ID:nineinchnick,项目名称:yii2-dynamic-ar,代码行数:39,代码来源:DynamicActiveRecord.php

示例12: __set

 public function __set($key, $value)
 {
     if ($key = $this->hasKey($key)) {
         parent::__set($key, $value);
     }
 }
开发者ID:JiltImageBoard,项目名称:jilt-backend,代码行数:6,代码来源:ARExtended.php

示例13: __set

 /**
  * @inheritdoc
  */
 public function __set($name, $value)
 {
     if ($name === 'group') {
         $this->_schema = static::$schemaDefinition[$value];
     }
     if ($this->_schema && isset($this->_schema[$name])) {
         $this->_values[$name] = $value;
     } else {
         parent::__set($name, $value);
     }
 }
开发者ID:sangkil,项目名称:application,代码行数:14,代码来源:GlobalConfig.php

示例14: __set

 public function __set($name, $value)
 {
     $extraFields = $this->parseExtraField();
     if (in_array($name, $extraFields)) {
         $this->_extraFields[$name] = $value;
     } else {
         parent::__set($name, $value);
     }
 }
开发者ID:devbrom,项目名称:yii2-releases,代码行数:9,代码来源:ActiveRecordWithExtraFields.php

示例15: __set

 /**
  * PHP setter magic method.
  * This method is overridden so that AR attributes can be accessed like properties,
  * but only if the current model is not read only
  * @param string $name property name
  * @param mixed $value property value
  * @throws Exception if the current record is read only
  */
 public function __set($name, $value)
 {
     if ($this->getReadOnly()) {
         throw new Exception('Attempting to set attribute `' . $name . '` on a read only ' . Tools::getClassName($this) . ' model');
     }
     parent::__set($name, $value);
 }
开发者ID:fangface,项目名称:yii2-concord,代码行数:15,代码来源:ActiveRecord.php


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