コード例 #1
1
ファイル: FakedValidationModel.php プロジェクト: howq/yii2
 public function __get($name)
 {
     if (stripos($name, 'attr') === 0) {
         return isset($this->attr[$name]) ? $this->attr[$name] : null;
     }
     return parent::__get($name);
 }
コード例 #2
0
 public function __get($name)
 {
     if (isset($this->_attributes[$name])) {
         return $this->_attributes[$name];
     }
     return parent::__get($name);
 }
コード例 #3
0
ファイル: DbCollection.php プロジェクト: gangbo/yii2-dbschema
 /**
  * @param string $name
  * @return mixed
  * @throws \yii\base\UnknownPropertyException
  */
 public function __get($name)
 {
     if (parent::hasProperty($name)) {
         return parent::__get($name);
     }
     return $this->db->{$name};
 }
コード例 #4
0
ファイル: Yml.php プロジェクト: Razzwan/dotplant2
 /**
  * @inheritdoc
  */
 public function __get($name)
 {
     if (isset($this->attrStorage[$name])) {
         return $this->attrStorage[$name];
     }
     return parent::__get($name);
 }
コード例 #5
0
ファイル: PackageModel.php プロジェクト: Liv1020/cms
 /**
  * @param string $name
  * @return mixed
  * @throws \yii\base\UnknownPropertyException
  */
 public function __get($name)
 {
     if (array_key_exists($name, $this->apiData)) {
         return ArrayHelper::getValue($this->apiData, $name);
     }
     return parent::__get($name);
 }
コード例 #6
0
 public function __get($name)
 {
     if (!isset($this->{$name})) {
         return false;
     }
     parent::__get($name);
 }
コード例 #7
0
ファイル: Model.php プロジェクト: heartshare/yii2-collection
 /**
  * This method is overridden to support accessing items like properties.
  *
  * @param string $name component or property name
  *
  * @return mixed item of found or the named property value
  */
 public function __get($name)
 {
     if ($name && $this->canGetProperty($name)) {
         return parent::__get($name);
     } else {
         return $this->getItem($name);
     }
 }
コード例 #8
0
ファイル: DynamicModel.php プロジェクト: diandianxiyu/Yii2Api
 /**
  * @inheritdoc
  */
 public function __get($name)
 {
     if (array_key_exists($name, $this->_attributes)) {
         return $this->_attributes[$name];
     } else {
         return parent::__get($name);
     }
 }
コード例 #9
0
ファイル: ParamsModel.php プロジェクト: fgh151/yii2-params
 /**
  * @param string $name
  * @return mixed
  * @throws \yii\base\UnknownPropertyException
  */
 public function __get($name)
 {
     if (key_exists($name, $this->_attributes)) {
         $result = $this->_attributes[$name];
     } else {
         $result = parent::__get($name);
     }
     return $result;
 }
コード例 #10
0
ファイル: Yml.php プロジェクト: tqsq2005/dotplant2
 /**
  * @inheritdoc
  */
 public function __get($name)
 {
     if (isset($this->attrStorage[$name])) {
         return $this->attrStorage[$name];
     }
     if (in_array($name, $this->attributes())) {
         return '';
     }
     return parent::__get($name);
 }
コード例 #11
0
 public function __get($name)
 {
     if (in_array($name, ['creditCard_number', 'creditCard_expirationDate', 'creditCard_cvv'])) {
         if (!isset($this->_attributes[$name])) {
             $this->_attributes[$name] = null;
         }
         return $this->_attributes[$name];
     }
     return parent::__get($name);
 }
コード例 #12
0
ファイル: SettingsBase.php プロジェクト: vetoni/toko
 /**
  * @param string $name
  * @return $this|mixed
  * @throws \yii\base\UnknownPropertyException
  */
 public function __get($name)
 {
     if (isset($this->_attributes[$name])) {
         return $this->_attributes[$name];
     }
     $_name = explode('.', $name);
     if (count($_name) == 2) {
         return Settings::value($_name[0], $_name[1]);
     }
     return parent::__get($name);
 }
コード例 #13
0
ファイル: Request.php プロジェクト: gogl92/yii2-teleduino
 public function __get($name)
 {
     if (array_key_exists($name, array_flip($this->extraAttributes))) {
         if (isset($this->extraAttributesData[$name])) {
             return $this->extraAttributesData[$name];
         } else {
             return null;
         }
     }
     return parent::__get($name);
 }
コード例 #14
0
ファイル: FormModel.php プロジェクト: yinheark/yincart2
 public function __get($name)
 {
     if (isset($this->models[$name])) {
         return $this->models[$name];
     }
     foreach ($this->models as $model) {
         if ($model->hasAttribute($name)) {
             return $model->getAttribute($name);
         }
     }
     return parent::__get($name);
 }
コード例 #15
0
ファイル: PayBase.php プロジェクト: lubaogui/yii2-payment
 /**
  * @brief 获取属性名称
  *
  * @return  public function 
  * @retval   
  * @see 
  * @note 
  * @author 吕宝贵
  * @date 2016/03/07 15:49:24
  **/
 public function __get($name)
 {
     if (isset($this->_attributes[$name]) || array_key_exists($name, $this->_attributes)) {
         return $this->_attributes[$name];
     } elseif ($this->hasAttribute($name)) {
         return null;
     } else {
         if (isset($this->_related[$name]) || array_key_exists($name, $this->_related)) {
             return $this->_related[$name];
         }
         $value = parent::__get($name);
         return $value;
     }
 }
コード例 #16
0
ファイル: ItemForm.php プロジェクト: nanodesu88/easyii
 public function __get($propertyName)
 {
     if ($this->canGetProperty($propertyName)) {
         return parent::__get($propertyName);
     }
     try {
         return $this->item->{$propertyName};
     } catch (\Exception $e) {
     }
     $t = $this->item->data;
     if (isset($t->{$propertyName})) {
         return $t->{$propertyName};
     }
 }
コード例 #17
0
ファイル: BaseActiveRecord.php プロジェクト: selenzo/bsuir
 /**
  * PHP getter magic method.
  * This method is overridden so that attributes and related objects can be accessed like properties.
  *
  * @param string $name property name
  * @throws \yii\base\InvalidParamException if relation name is wrong
  * @return mixed property value
  * @see getAttribute()
  */
 public function __get($name)
 {
     if (isset($this->_attributes[$name]) || array_key_exists($name, $this->_attributes)) {
         return $this->_attributes[$name];
     } elseif ($this->hasAttribute($name)) {
         return null;
     } else {
         if (isset($this->_related[$name]) || array_key_exists($name, $this->_related)) {
             return $this->_related[$name];
         }
         $value = parent::__get($name);
         if ($value instanceof ActiveQueryInterface) {
             return $this->_related[$name] = $value->findFor($name, $this);
         } else {
             return $value;
         }
     }
 }
コード例 #18
0
ファイル: AuthClientModel.php プロジェクト: simplator/user
 public function __get($name)
 {
     if (in_array($name, $this->getClientAttributes())) {
         return $this->_entity->{$name};
     }
     if (isset($this->_entity->{$name})) {
         return $this->_entity->{$name};
     }
     return parent::__get($name);
 }
コード例 #19
0
 public function __get($name)
 {
     if ($name == 'scenario') {
         return parent::__get($name);
     }
     if (property_exists(get_class($this), $name)) {
         return $this->{$name};
     } else {
         if (array_key_exists($name, $this->dynAttributes)) {
             return $this->dynAttributes[$name];
         }
     }
 }
コード例 #20
0
 /**
  * PHP getter magic method.
  * This method is overridden so that attributes and related objects can be accessed like properties.
  *
  * @param string $name property name
  * @throws \yii\base\InvalidParamException if relation name is wrong
  * @return mixed property value
  * @see getAttribute()
  */
 public function __get($name)
 {
     // getAttribute() has better performance than hasAttribute() for attributes that are set
     if (($value = $this->getAttribute($name)) !== null || $this->hasAttribute($name)) {
         return $value;
     } else {
         if (isset($this->_related[$name]) || array_key_exists($name, $this->_related)) {
             return $this->_related[$name];
         }
         $value = parent::__get($name);
         if ($value instanceof ActiveQueryInterface) {
             return $this->_related[$name] = $value->findFor($name, $this);
         } else {
             return $value;
         }
     }
 }
コード例 #21
0
ファイル: AbstractModel.php プロジェクト: Jamshid90/dotplant2
 public function __get($name)
 {
     if (isset($this->values_by_property_key[$name])) {
         return $this->values_by_property_key[$name]->toValue($this->arrayMode);
     }
     return parent::__get($name);
 }
コード例 #22
0
 /**
  * PHP getter magic method.
  * This method is overridden so that attributes and related objects can be accessed like properties.
  * @param string $name property name
  * @return mixed property value
  * @see getAttribute()
  */
 public function __get($name)
 {
     if (isset($this->_attributes[$name]) || array_key_exists($name, $this->_attributes)) {
         return $this->_attributes[$name];
     } elseif ($this->hasAttribute($name)) {
         return null;
     } else {
         if (isset($this->_related[$name]) || array_key_exists($name, $this->_related)) {
             return $this->_related[$name];
         }
         $value = parent::__get($name);
         if ($value instanceof ActiveRelationInterface) {
             if (method_exists($this, 'get' . $name)) {
                 $method = new \ReflectionMethod($this, 'get' . $name);
                 $realName = lcfirst(substr($method->getName(), 3));
                 if ($realName !== $name) {
                     throw new InvalidParamException('Relation names are case sensitive. ' . get_class($this) . " has a relation named \"{$realName}\" instead of \"{$name}\".");
                 }
             }
             return $this->_related[$name] = $value->multiple ? $value->all() : $value->one();
         } else {
             return $value;
         }
     }
 }
コード例 #23
0
 public function __get($name)
 {
     try {
         parent::__get($name);
     } catch (UnknownPropertyException $e) {
         if (isset($this->_attr[$name])) {
             return $this->_attr[$name];
         }
     }
 }