Пример #1
0
 public function __get($name)
 {
     if (in_array($name, $this->attributes)) {
         /* @var $owner Model; */
         $owner = $this->owner;
         $attr1 = $name . '1';
         $attr2 = $name . '2';
         $d1 = $owner->{$attr1};
         $d2 = $owner->{$attr2};
         if (!$d1 || !$d2) {
             return null;
         }
         $date1 = DateTime::createFromFormat($this->format, $d1);
         $date2 = DateTime::createFromFormat($this->format, $d2);
         // if years are different, we take the first
         $y1 = $date1->format('Y');
         $r = ['y' => $y1];
         $m1 = $date1->format('n');
         if ($y1 == $date2->format('Y') && $m1 == $date2->format('n')) {
             $r['m'] = $m1;
             $d1 = $date1->format('j');
             $r['d'] = $d1 == $date2->format('j') ? $d1 : null;
         } else {
             $r['m'] = null;
             $r['d'] = null;
         }
         return $r;
     }
     return parent::__get($name);
 }
 public function __get($name)
 {
     if ($this->hasAttribute($name)) {
         return $this->getAttribute($name);
     }
     return parent::__get($name);
 }
Пример #3
0
 public function __get($name)
 {
     if ($this->fileInputName == $name) {
         return $this->_file;
     }
     return parent::__get($name);
 }
Пример #4
0
 /**
  * Returns the value of an object property.
  * @param stirng $name the property name
  */
 public function __get($name)
 {
     if (!in_array($name, $this->attrs)) {
         return parent::__get($name);
     }
     return $this->getInterpretation($name);
 }
Пример #5
0
 public function __get($name)
 {
     if ($name == $this->getAttributeName()) {
         return $this->getRelation();
     }
     return parent::__get($name);
 }
 public function __get($name)
 {
     if ($this->hasLocalValue($name)) {
         return $this->getLocalValue($name);
     } else {
         return parent::__get($name);
     }
 }
Пример #7
0
 /**
  * @inheritdoc
  */
 public function __get($name)
 {
     if (stripos($name, 'client') === 0) {
         return strcasecmp($name, 'clientId') == 0 ? $this->_clientId : $this->getClientProperty(strtolower($name));
     } else {
         return parent::__get($name);
     }
 }
Пример #8
0
 /**
  * @inheritdoc
  */
 public function __get($name)
 {
     try {
         return parent::__get($name);
     } catch (\Exception $e) {
         return $this->getAttribute($name);
     }
 }
Пример #9
0
 public function __get($param)
 {
     if (isset($this->attributes[$param])) {
         return $this->convertToLogical($this->owner->{$this->attributes[$param]});
     } else {
         return parent::__get($param);
     }
 }
 /**
  * @inheritdoc
  */
 public function __get($name)
 {
     if ($this->checkName($name)) {
         return $this->storage;
     } else {
         return parent::__get($name);
     }
 }
Пример #11
0
 public function __get($name)
 {
     $rels = array_flip($this->directoryAttributes);
     if (isset($rels[$name])) {
         return $this->getDirectory($rels[$name]);
     }
     return parent::__get($name);
 }
Пример #12
0
 public function __get($name)
 {
     if (preg_match('/^(.+)(_image)$/', $name, $m) && isset($m[1]) && isset($this->imageFields[$m[1]])) {
         return $this->getImage($m[1]);
     }
     return parent::__get($name);
     // TODO: Change the autogenerated stub
 }
Пример #13
0
 /**
  * @inheritdoc
  */
 public function __get($name)
 {
     $this->initProperties();
     if (isset($this->_properties[$name]) || array_key_exists($name, $this->_properties)) {
         return $this->_properties[$name];
     }
     return parent::__get($name);
 }
Пример #14
0
 public function __get($name)
 {
     if ($this->_relation->canGetProperty($name)) {
         return $this->_relation->{$name};
     } else {
         return parent::__get($name);
     }
 }
 public function __get($name)
 {
     if ($name == $this->propertyName) {
         return $this->getRelationIds();
     } else {
         return parent::__get($name);
     }
 }
Пример #16
0
 public function __get($name)
 {
     if (in_array($name, $this->mediasAttributes)) {
         return $this->getMedias($name);
     } else {
         return parent::__get($name);
     }
 }
Пример #17
0
 /**
  * Make [[$attributes]] readable
  * @inheritdoc
  */
 public function __get($param)
 {
     if (isset($this->attributes[$param])) {
         //return $this->convertFromStoredFormat($this->owner->__get($this->attributes[$param]));
         return $this->convertFromStoredFormat($this->owner->{$this->attributes[$param]});
     } else {
         return parent::__get($param);
     }
 }
 /**
  * @inheritdoc
  */
 public function __get($name)
 {
     if (isset($this->attributes[$name])) {
         $attrValue = $this->owner->{$this->attributes[$name]};
         return $this->convertToLogical($attrValue, $name);
     } else {
         return parent::__get($name);
     }
 }
Пример #19
0
 public function __get($name)
 {
     if ($name != $this->attribute) {
         return parent::__get($name);
     }
     if ($this->value == null) {
         $this->value = $this->getValue();
     }
     return $this->value;
 }
 /**
  * 
  * @param type $name
  * @return type
  */
 public function __get($name)
 {
     if (strpos($name, 'field') === 0 && $this->hasFieldByModelMap($name)) {
         return $this->getFieldByModelMap($name);
     }
     if ($this->hasAttr($name)) {
         return $this->getAttr($name);
     } else {
         return parent::__get($name);
     }
 }
 /**
  * Make [[$translationAttributes]] readable
  * @inheritdoc
  */
 public function __get($name)
 {
     if (!in_array($name, $this->translationAttributes) && !isset($this->_models[$name])) {
         return parent::__get($name);
     }
     if (isset($this->owner->{$this->translationsAttribute}[$name])) {
         return $this->owner->{$this->translationsAttribute};
     }
     $model = $this->getTranslation();
     return $model->{$name};
 }
Пример #22
0
 /**
  * @inheritdoc
  */
 public function __get($name)
 {
     try {
         return parent::__get($name);
     } catch (UnknownPropertyException $e) {
         if ($this->isUploadAttribute($name)) {
             return $this->getUploadValue();
         } else {
             throw $e;
         }
     }
 }
Пример #23
0
 /**
  * @inheritdoc
  */
 public function __get($name)
 {
     try {
         return parent::__get($name);
     } catch (UnknownPropertyException $exception) {
         $model = $this->getDefaultModel();
         if (is_object($model) && $model->hasAttribute($name)) {
             return $model->{$name};
         }
         throw $exception;
     }
 }
 /**
  * Make [[$translationAttributes]] readable
  * @inheritdoc
  */
 public function __get($name)
 {
     if (!in_array($name, $this->translationAttributes) && !isset($this->_models[$name])) {
         return parent::__get($name);
     }
     if (isset($this->_models[$name])) {
         return $this->_models[$name];
     }
     // default language fallback
     if (!$this->modelHasTranslation($this->getLanguage(), $name)) {
         $fallbackLanguage = isset(Yii::$app->params['fallbackLanguage']) ? Yii::$app->params['fallbackLanguage'] : null;
         if (isset($fallbackLanguage)) {
             $translation = $this->getTranslation($fallbackLanguage);
             if (!$this->modelHasTranslation($fallbackLanguage, $name)) {
                 $translation = $this->loadTranslation(Yii::$app->params['appMainLanguage']);
             }
         }
         return $translation->{$name};
     }
     $model = $this->getTranslation();
     return $model->{$name};
 }
 public function __get($name)
 {
     if ($this->hasStoreRelation($name)) {
         return $this->getStoreRelation($name)->getValue();
     }
     return parent::__get($name);
 }
 /**
  * Returns the value of an object property.
  *
  * Do not call this method directly as it is a PHP magic method that
  * will be implicitly called when executing `$value = $object->property;`.
  *
  * @param string $name the property name
  *
  * @return mixed the property value
  * @throws UnknownPropertyException if the property is not defined
  * @throws InvalidCallException if the property is write-only
  * @see __set()
  */
 public function __get($name)
 {
     try {
         return parent::__get($name);
     } catch (UnknownPropertyException $e) {
         if ($this->hasTranslateAttribute($name)) {
             return $this->getTranslateAttribute($name);
         } else {
             throw $e;
         }
     }
 }
Пример #27
0
 /**
  * @inheritdoc
  */
 public function __get($name)
 {
     if ($this->isAttribute($name)) {
         return $this->getAttributeValue($this->delimiter === false);
     } else {
         return parent::__get($name);
     }
 }
Пример #28
0
 /**
  * PHP getter magic method.
  * This method is overridden so that variation attributes can be accessed like properties.
  *
  * @param string $name property name
  * @throws UnknownPropertyException if the property is not defined
  * @return mixed property value
  */
 public function __get($name)
 {
     try {
         return parent::__get($name);
     } catch (UnknownPropertyException $exception) {
         if ($this->owner !== null) {
             $model = $this->getDefaultVariationModel();
             if (is_object($model) && $model->hasAttribute($name)) {
                 $result = $model->{$name};
                 if (empty($result) && array_key_exists($name, $this->variationAttributeDefaultValueMap)) {
                     return $this->fetchVariationAttributeDefaultValue($name);
                 }
                 return $result;
             } elseif (array_key_exists($name, $this->variationAttributeDefaultValueMap)) {
                 return $this->fetchVariationAttributeDefaultValue($name);
             }
         }
         throw $exception;
     }
 }
 /**
  * @inheritdoc
  */
 public function __get($name)
 {
     try {
         return parent::__get($name);
     } catch (UnknownPropertyException $e) {
         if ($this->hasLangAttribute($name)) {
             return $this->getLangAttribute($name);
         } else {
             throw $e;
         }
         // @codeCoverageIgnoreEnd
     }
 }
Пример #30
0
 /**
  * PHP getter magic method.
  * This method is overridden so that variation attributes can be accessed like properties.
  *
  * @param string $name property name
  * @throws UnknownPropertyException if the property is not defined
  * @return mixed property value
  */
 public function __get($name)
 {
     try {
         return parent::__get($name);
     } catch (UnknownPropertyException $exception) {
         if ($this->owner !== null) {
             if ($name === $this->fileAttribute) {
                 return $this->getUploadedFile();
             }
         }
         throw $exception;
     }
 }