DynamicActiveRecord.php
public function setAttribute($name, $value)
    {
        try {
            parent::__set($name, $value);

            return;
        } catch (UnknownPropertyException $ignore) {
        }

        $path = explode('.', $name);
        $ref = &$this->_dynamicAttributes;

        // Walk forwards through $path to find the deepest key already set.
        do {
            $key = $path[0];
            if (isset($ref[$key])) {
                $ref = &$ref[$key];
                array_shift($path);
            } else {
                break;
            }
        } while ($path);

        // If the whole path already existed then we can just set it.
        if (!$path) {
            $ref = $value;

            return;
        }

        // There is remaining path so we have to set a new leaf with the first
        // part of the remaining path as key. But first, if there is any path
        // beyond that then we need build an array to set as the new leaf value.
        while (count($path) > 1) {
            $key = array_pop($path);
            $value = [$key => $value];
        }
        $ref[$path[0]] = $value;
    }
public function setAttribute($name, $value)
    {
        try {
            parent::__set($name, $value);

            return;
        } catch (UnknownPropertyException $ignore) {
        }

        $path = explode('.', $name);
        $ref = &$this->_dynamicAttributes;

        // Walk forwards through $path to find the deepest key already set.
        do {
            $key = $path[0];
            if (isset($ref[$key])) {
                $ref = &$ref[$key];
                array_shift($path);
            } else {
                break;
            }
        } while ($path);

        // If the whole path already existed then we can just set it.
        if (!$path) {
            $ref = $value;

            return;
        }

        // There is remaining path so we have to set a new leaf with the first
        // part of the remaining path as key. But first, if there is any path
        // beyond that then we need build an array to set as the new leaf value.
        while (count($path) > 1) {
            $key = array_pop($path);
            $value = [$key => $value];
        }
        $ref[$path[0]] = $value;
    }
public function setAttribute ( $ name , $ value ) { try { parent :: __set ( $ name , $ value ) ; return ; } catch ( UnknownPropertyException $ ignore ) { } $ path = explode ( '.' , $ name ) ; $ ref = & $ this -> _dynamicAttributes ; // Walk forwards through $path to find the deepest key already set. do { $ key = $ path [ 0 ] ; if ( isset ( $ ref [ $ key ] ) ) { $ ref = & $ ref [ $ key ] ; array_shift ( $ path ) ; } else { break ; } } while ( $ path ) ; // If the whole path already existed then we can just set it. if ( ! $ path ) { $ ref = $ value ; return ; } // There is remaining path so we have to set a new leaf with the first // part of the remaining path as key. But first, if there is any path // beyond that then we need build an array to set as the new leaf value. while ( count ( $ path ) > 1 ) { $ key = array_pop ( $ path ) ; $ value = [ $ key => $ value ] ; } $ ref [ $ path [ 0 ] ] = $ value ; }
Sets a model attribute.

@param string $name attribute name, use dotted notation for structured attributes.
@param mixed $value the attribute value. A value of null effectively unsets the attribute.
Sets a model attribute .