src/common/BaseInstanceWrapperComponent.php
protected function setInstProperty($inst, $propertyName, $mappingDefinition, $propertyValue = null)
    {
        if ($mappingDefinition === false) {
            return false; // Do not even attempt to set this property
        }
        if (func_num_args() <= 3) {
            $propertyValue = $this->$propertyName;
        }
        if ($mappingDefinition === true ||
                is_string($mappingDefinition)) {
            $instPropertyName = $mappingDefinition === true ? $propertyName : $mappingDefinition;

            $setInstPropertyMethod = 'setInstProperty' . ucfirst($instPropertyName);
            if (method_exists($this, $setInstPropertyMethod)) {
                $this->$setInstPropertyMethod($propertyValue, $inst);
                return;
            } else {
                $instSetterMethod = 'set' . ucfirst($instPropertyName);
                if (method_exists($inst, $instSetterMethod)) {
                    $inst->$instSetterMethod($propertyValue);
                    return;
                } else {
                    $inst->$instPropertyName = $propertyValue;
                    return;
                }
            }
        } elseif (is_array($mappingDefinition)) {
            if (reset($mappingDefinition) === null) {
                $mappingDefinition[0] = $inst;
                call_user_func_array($mappingDefinition, [$propertyValue]);
                return;
            } elseif (reset($mappingDefinition) === $this) {
                call_user_func_array($mappingDefinition, [$propertyValue, $inst]);
                return;
            }
        }
        throw new \yii\base\ErrorException('Could not set property ' . $propertyName . ' in wrapped object');
    }
protected function setInstProperty($inst, $propertyName, $mappingDefinition, $propertyValue = null)
    {
        if ($mappingDefinition === false) {
            return false; // Do not even attempt to set this property
        }
        if (func_num_args() <= 3) {
            $propertyValue = $this->$propertyName;
        }
        if ($mappingDefinition === true ||
                is_string($mappingDefinition)) {
            $instPropertyName = $mappingDefinition === true ? $propertyName : $mappingDefinition;

            $setInstPropertyMethod = 'setInstProperty' . ucfirst($instPropertyName);
            if (method_exists($this, $setInstPropertyMethod)) {
                $this->$setInstPropertyMethod($propertyValue, $inst);
                return;
            } else {
                $instSetterMethod = 'set' . ucfirst($instPropertyName);
                if (method_exists($inst, $instSetterMethod)) {
                    $inst->$instSetterMethod($propertyValue);
                    return;
                } else {
                    $inst->$instPropertyName = $propertyValue;
                    return;
                }
            }
        } elseif (is_array($mappingDefinition)) {
            if (reset($mappingDefinition) === null) {
                $mappingDefinition[0] = $inst;
                call_user_func_array($mappingDefinition, [$propertyValue]);
                return;
            } elseif (reset($mappingDefinition) === $this) {
                call_user_func_array($mappingDefinition, [$propertyValue, $inst]);
                return;
            }
        }
        throw new \yii\base\ErrorException('Could not set property ' . $propertyName . ' in wrapped object');
    }
protected function setInstProperty ( $ inst , $ propertyName , $ mappingDefinition , $ propertyValue = null ) { if ( $ mappingDefinition === false ) { return false ; // Do not even attempt to set this property } if ( func_num_args ( ) <= 3 ) { $ propertyValue = $ this -> $ propertyName ; } if ( $ mappingDefinition === true || is_string ( $ mappingDefinition ) ) { $ instPropertyName = $ mappingDefinition === true ? $ propertyName : $ mappingDefinition ; $ setInstPropertyMethod = 'setInstProperty' . ucfirst ( $ instPropertyName ) ; if ( method_exists ( $ this , $ setInstPropertyMethod ) ) { $ this -> $ setInstPropertyMethod ( $ propertyValue , $ inst ) ; return ; } else { $ instSetterMethod = 'set' . ucfirst ( $ instPropertyName ) ; if ( method_exists ( $ inst , $ instSetterMethod ) ) { $ inst -> $ instSetterMethod ( $ propertyValue ) ; return ; } else { $ inst -> $ instPropertyName = $ propertyValue ; return ; } } } elseif ( is_array ( $ mappingDefinition ) ) { if ( reset ( $ mappingDefinition ) === null ) { $ mappingDefinition [ 0 ] = $ inst ; call_user_func_array ( $ mappingDefinition , [ $ propertyValue ] ) ; return ; } elseif ( reset ( $ mappingDefinition ) === $ this ) { call_user_func_array ( $ mappingDefinition , [ $ propertyValue , $ inst ] ) ; return ; } } throw new \ yii \ base \ ErrorException ( 'Could not set property ' . $ propertyName . ' in wrapped object' ) ; }
Sets the value of a property

Automatic mapping

Automatic mapping is used, if $mappingDefinition is true or contains a property name.
In this case, the following steps are performed:

1)   Check if a method named setInstPropertyXxxx exists in $this. If the method exists, it is called and the called
method is responsible to set the property in $inst.
2)   Check if a method name setXxxx exists in $inst. If this method exists, it is called. The property value
is passed in the first parameter.
3)   $inst->Xxxx is set directly.

@param type $inst
@param type $propertyName
@param type $mappingDefinition
@param type $propertyValue
@return boolean
@throws \yii\base\ErrorException
Sets the value of a property