Beispiel #1
1
 public function __get($name)
 {
     if (stripos($name, 'attr') === 0) {
         return isset($this->attr[$name]) ? $this->attr[$name] : null;
     }
     return parent::__get($name);
 }
 public function __get($name)
 {
     if (isset($this->_attributes[$name])) {
         return $this->_attributes[$name];
     }
     return parent::__get($name);
 }
Beispiel #3
0
 /**
  * @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};
 }
Beispiel #4
0
 /**
  * @inheritdoc
  */
 public function __get($name)
 {
     if (isset($this->attrStorage[$name])) {
         return $this->attrStorage[$name];
     }
     return parent::__get($name);
 }
Beispiel #5
0
 /**
  * @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);
 }
Beispiel #6
0
 public function __get($name)
 {
     if (!isset($this->{$name})) {
         return false;
     }
     parent::__get($name);
 }
Beispiel #7
0
 /**
  * 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);
     }
 }
Beispiel #8
0
 /**
  * @inheritdoc
  */
 public function __get($name)
 {
     if (array_key_exists($name, $this->_attributes)) {
         return $this->_attributes[$name];
     } else {
         return parent::__get($name);
     }
 }
Beispiel #9
0
 /**
  * @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;
 }
Beispiel #10
0
 /**
  * @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);
 }
 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);
 }
Beispiel #12
0
 /**
  * @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);
 }
Beispiel #13
0
 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);
 }
Beispiel #14
0
 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);
 }
Beispiel #15
0
 /**
  * @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;
     }
 }
Beispiel #16
0
 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};
     }
 }
Beispiel #17
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)
 {
     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;
         }
     }
 }
Beispiel #18
0
 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);
 }
 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];
         }
     }
 }
 /**
  * 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;
         }
     }
 }
Beispiel #21
0
 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);
 }
 /**
  * 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;
         }
     }
 }
 public function __get($name)
 {
     try {
         parent::__get($name);
     } catch (UnknownPropertyException $e) {
         if (isset($this->_attr[$name])) {
             return $this->_attr[$name];
         }
     }
 }