Ejemplo n.º 1
0
 public function __set($name, $value)
 {
     if ($this->fileInputName == $name) {
         return $this->_file = $value;
     }
     return parent::__set($name, $value);
 }
 public function __set($name, $value)
 {
     if ($this->checkName($name)) {
         $this->setAttributes($value);
     } else {
         parent::__set($name, $value);
     }
 }
Ejemplo n.º 3
0
 /**
  * @inheritdoc
  */
 public function __set($name, $value)
 {
     try {
         parent::__set($name, $value);
     } catch (\Exception $e) {
         $this->setAttribute($name, $value);
     }
 }
 /**
  * 
  * @param type $name
  * @param type $value
  * @return type
  */
 public function __set($name, $value)
 {
     if ($this->hasAttr($name)) {
         return $this->setAttr($name, $value);
     } else {
         parent::__set($name, $value);
     }
 }
 /**
  * Make [[$translationAttributes]] writable
  * @param string $name
  * @param mixed $value
  */
 public function __set($name, $value)
 {
     if (in_array($name, $this->translationAttributes)) {
         $this->getTranslation()->{$name} = $value;
     } else {
         parent::__set($name, $value);
     }
 }
 public function __set($name, $value)
 {
     if ($name == $this->propertyName) {
         $this->setRelationIds($value);
     } else {
         parent::__set($name, $value);
     }
 }
 public function __set($name, $value)
 {
     if ($this->hasLocalValue($name)) {
         $this->setLocalValue($name, $value);
     } else {
         parent::__set($name, $value);
     }
 }
Ejemplo n.º 8
0
 public function __set($name, $value)
 {
     if ($this->_relation->canGetProperty($name)) {
         $this->_relation->{$name} = $value;
     } else {
         parent::__set($name, $value);
     }
 }
 public function __set($name, $value)
 {
     if ($this->hasAttribute($name)) {
         $this->setAttribute($name, $value);
         return;
     }
     parent::__set($name, $value);
 }
Ejemplo n.º 10
0
 /**
  * @inheritdoc
  */
 public function __set($name, $value)
 {
     if (isset($this->attributes[$name])) {
         $this->owner->{$this->attributes[$name]} = $this->convertToPhysical($value, $name);
     } else {
         parent::__set($name, $value);
     }
 }
Ejemplo n.º 11
0
 /**
  * @param string $name
  * @param mixed $value
  * @throws \yii\base\UnknownPropertyException
  */
 public function __set($name, $value)
 {
     if ($this->checkAttribute($name)) {
         $this->voteAttributes[$name] = !is_null($value) ? (int) $value : null;
     } else {
         parent::__set($name, $value);
     }
 }
Ejemplo n.º 12
0
 public function __set($name, $value)
 {
     $rels = array_flip($this->directoryAttributes);
     if (isset($rels[$name])) {
         $this->setDirectory($rels[$name], $value);
     } else {
         parent::__set($name, $value);
     }
 }
Ejemplo n.º 13
0
 /**
  * Make [[$attributes]] writable
  * @inheritdoc
  */
 public function __set($param, $value)
 {
     if (isset($this->attributes[$param])) {
         //$this->owner->__set($this->attributes[$param], $this->convertToStoredFormat($value));
         $this->owner->{$this->attributes[$param]} = $this->convertToStoredFormat($value);
     } else {
         parent::__set($param, $value);
     }
 }
Ejemplo n.º 14
0
 /**
  * @inheritdoc
  */
 public function __set($name, $value)
 {
     if (stripos($name, 'client') === 0) {
         if (strcasecmp($name, 'clientId') == 0) {
             throw new InvalidCallException('Setting read-only property: ' . get_class($this) . '::' . $name);
         }
         $this->setClientProperty(strtolower($name), $value);
     } else {
         parent::__set($name, $value);
     }
 }
 /**
  * Make [[$translationAttributes]] writable
  */
 public function __set($name, $value)
 {
     if (in_array($name, $this->translationAttributes)) {
         if (is_array($value) and isset($value['translations'])) {
             foreach ($value['translations'] as $language => $translatedValue) {
                 $this->getTranslation($language)->{$name} = $translatedValue;
             }
         } else {
             $this->getTranslation()->{$name} = $value;
         }
     } else {
         parent::__set($name, $value);
     }
 }
Ejemplo n.º 16
0
 /**
  * PHP setter magic method.
  * This method is overridden so that relation attribute can be accessed like property.
  * @param string $name property name
  * @param mixed $value property value
  * @throws UnknownPropertyException if the property is not defined
  */
 public function __set($name, $value)
 {
     try {
         parent::__set($name, $value);
     } catch (UnknownPropertyException $exception) {
         if ($name === $this->relationReferenceAttribute) {
             $this->setRelationReferenceAttributeValue($value);
         } else {
             throw $exception;
         }
     }
 }
 public function __set($name, $value)
 {
     if ($this->hasStoreRelation($name)) {
         $this->getStoreRelation($name)->setValue($value);
         return;
     }
     parent::__set($name, $value);
 }
 /**
  * Sets 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 `$object->property = $value;`.
  *
  * @param string $name  the property name or the event name
  * @param mixed  $value the property value
  *
  * @throws UnknownPropertyException if the property is not defined
  * @throws InvalidCallException if the property is read-only
  * @see __get()
  */
 public function __set($name, $value)
 {
     try {
         parent::__set($name, $value);
     } catch (UnknownPropertyException $e) {
         if ($this->hasTranslateAttribute($name)) {
             $this->setTranslateAttribute($name, $value);
         } else {
             throw $e;
         }
     }
 }
Ejemplo n.º 19
0
 /**
  * @inheritdoc
  */
 public function __set($name, $value)
 {
     if ($this->isAttribute($name)) {
         $this->setAttributeValue($value);
     } else {
         parent::__set($name, $value);
     }
 }
Ejemplo n.º 20
0
 /**
  * PHP setter magic method.
  * This method is overridden so that variation attributes can be accessed like properties.
  * @param string $name property name
  * @param mixed $value property value
  * @throws UnknownPropertyException if the property is not defined
  */
 public function __set($name, $value)
 {
     try {
         parent::__set($name, $value);
     } catch (UnknownPropertyException $exception) {
         if ($this->owner !== null) {
             $model = $this->getDefaultVariationModel();
             if ($model->hasAttribute($name)) {
                 $model->{$name} = $value;
                 return;
             }
         }
         throw $exception;
     }
 }
 /**
  * @inheritdoc
  */
 public function __set($name, $value)
 {
     try {
         parent::__set($name, $value);
     } catch (UnknownPropertyException $e) {
         if ($this->hasLangAttribute($name)) {
             $this->setLangAttribute($name, $value);
         } else {
             throw $e;
         }
         // @codeCoverageIgnoreEnd
     }
 }
Ejemplo n.º 22
0
 /**
  * PHP setter magic method.
  * This method is overridden so that variation attributes can be accessed like properties.
  * @param string $name property name
  * @param mixed $value property value
  * @throws UnknownPropertyException if the property is not defined
  */
 public function __set($name, $value)
 {
     try {
         parent::__set($name, $value);
     } catch (UnknownPropertyException $exception) {
         if ($this->owner !== null) {
             if ($name === $this->fileAttribute) {
                 $this->setUploadedFile($value);
                 return;
             }
         }
         throw $exception;
     }
 }
Ejemplo n.º 23
0
 /**
  * PHP setter magic method.
  * This method is overridden so that role model attributes can be accessed like properties.
  * @param string $name property name
  * @param mixed $value property value
  * @throws UnknownPropertyException if the property is not defined
  */
 public function __set($name, $value)
 {
     try {
         parent::__set($name, $value);
     } catch (UnknownPropertyException $exception) {
         $model = $this->getRoleRelationModel();
         if ($model->hasAttribute($name) || $model->canSetProperty($name)) {
             $model->{$name} = $value;
         } else {
             throw $exception;
         }
     }
 }
 /**
  * @param string $name
  * @param mixed $value
  * @throws CannotGuessEventException
  * @throws EventNotFoundException
  * @throws InvalidSchemaException
  * @throws TransitionException
  * @throws \yii\base\UnknownPropertyException
  * @throws exceptions\StateNotFoundException
  * @throws null
  */
 public function __set($name, $value)
 {
     if ($name === $this->virtAttr) {
         $m = $this->owner;
         // Value did not change - ignore
         if ($m->{$this->attr} === $value) {
             return;
         }
         // First time? Initialize SM for $value state
         if ($m->{$this->attr} === null && $m->getIsNewRecord()) {
             if ($value !== $this->sm->getInitialStateValue()) {
                 throw new InvalidValueException("This attribute is just entering the State Machine and must be set to {$this->sm->getInitialStateValue()}");
             }
             $context = $this->initStateMachine();
         } else {
             // Not first time, try to trigger for $value
             $state = $this->sm->getState($m->{$this->attr});
             if (!$state) {
                 throw new InvalidSchemaException("Cannot load current state {$m->{$this->attr}}");
             }
             $event = $state->guessEvent($value, $this->internalGetUserRole(Yii::$app->user->identity));
             $context = $this->trigger($event);
         }
         // Migrate the context errors to the virtual attribute
         foreach ($context->errors as $attr => $error) {
             $m->addError($this->virtAttr, $error);
         }
     } else {
         parent::__set($name, $value);
     }
 }
Ejemplo n.º 25
0
 /**
  * Setter for relational attributes. Called only if attribute is exist in POST array. Method check value format
  * and put it to $this->relationalData array.
  *
  * {@inheritdoc}
  */
 public function __set($name, $value)
 {
     if (in_array($name, $this->relationalFields)) {
         if (!is_array($value) && !empty($value)) {
             $this->owner->addError($name, Yii::$app->getI18n()->format(Yii::t('yii', '{attribute} is invalid.'), ['attribute' => $this->owner->getAttributeLabel($name)], Yii::$app->language));
         } else {
             $this->relationalData[$name] = ['data' => $value];
         }
     } else {
         parent::__set($name, $value);
     }
 }
Ejemplo n.º 26
0
 /**
  * Magic property setter for relations
  * @param  string  $name      property name
  * @param  mixed   $value     value
  * @internal
  */
 public function __set($name, $value)
 {
     if (in_array($name, $this->_relations)) {
         // start setting relation data
         $config = [self::RELATIONS => &$this->relations];
         $this->setRelation($this->owner, $name, $value, $config);
         return $this->owner;
     }
     return parent::__set($name, $value);
 }
Ejemplo n.º 27
0
 /**
  * @inheritdoc
  */
 public function __set($name, $value)
 {
     if ($name == $this->attribute) {
         $this->newValues = $value;
     } else {
         parent::__set($name, $value);
     }
 }
Ejemplo n.º 28
0
 /**
  * @inheritdoc
  */
 public function __set($name, $value)
 {
     if ($this->transformedPropertyExists($name)) {
         $this->setTransformedProperty($name, $value);
     } else {
         parent::__set($name, $value);
     }
 }
 /**
  * @inheritdoc
  */
 public function __set($name, $value)
 {
     if ($this->hasAttributeValue($name)) {
         $this->attributeValues[$name]->setValue($value);
     } else {
         parent::__set($name, $value);
     }
 }
 /**
  * @inheritdoc
  */
 public function __set($name, $value)
 {
     if ($this->hasLangAttribute($name)) {
         $this->setLangAttribute($name, $value);
     } else {
         parent::__set($name, $value);
     }
 }