public static function setNestedObjectProperty($value, &$object, $memberPath) {


        // Explode the path on . firstly
        $explodedPath = explode(".", $memberPath);

        // Pop the final entry
        $finalBit = array_pop($explodedPath);

        // Now call above function to get down to the point we need
        if (sizeof($explodedPath) > 0) {
            $nestedProperty = ObjectUtils::getNestedObjectProperty($object, implode(".", $explodedPath));
            $immediateObject = &$nestedProperty;
        } else {
            $immediateObject = &$object;
        };

        $explodedMemberName = explode("[", $finalBit);

        $memberName = $explodedMemberName[0];

        if (is_array($immediateObject) || ($immediateObject instanceof AssociativeArray)) {

            $immediateObject[$memberName] = $value;

        } else if ($immediateObject instanceof SerialisableObject) {

            $immediateObject->__setSerialisablePropertyValue($memberName, $value);

        }

    }
public static function setNestedObjectProperty($value, &$object, $memberPath) {


        // Explode the path on . firstly
        $explodedPath = explode(".", $memberPath);

        // Pop the final entry
        $finalBit = array_pop($explodedPath);

        // Now call above function to get down to the point we need
        if (sizeof($explodedPath) > 0) {
            $nestedProperty = ObjectUtils::getNestedObjectProperty($object, implode(".", $explodedPath));
            $immediateObject = &$nestedProperty;
        } else {
            $immediateObject = &$object;
        };

        $explodedMemberName = explode("[", $finalBit);

        $memberName = $explodedMemberName[0];

        if (is_array($immediateObject) || ($immediateObject instanceof AssociativeArray)) {

            $immediateObject[$memberName] = $value;

        } else if ($immediateObject instanceof SerialisableObject) {

            $immediateObject->__setSerialisablePropertyValue($memberName, $value);

        }

    }
public static function setNestedObjectProperty ( $ value , & $ object , $ memberPath ) { // Explode the path on . firstly $ explodedPath = explode ( "." , $ memberPath ) ; // Pop the final entry $ finalBit = array_pop ( $ explodedPath ) ; // Now call above function to get down to the point we need if ( sizeof ( $ explodedPath ) > 0 ) { $ nestedProperty = ObjectUtils :: getNestedObjectProperty ( $ object , implode ( "." , $ explodedPath ) ) ; $ immediateObject = & $ nestedProperty ; } else { $ immediateObject = & $ object ; } ; $ explodedMemberName = explode ( "[" , $ finalBit ) ; $ memberName = $ explodedMemberName [ 0 ] ; if ( is_array ( $ immediateObject ) || ( $ immediateObject instanceof AssociativeArray ) ) { $ immediateObject [ $ memberName ] = $ value ; } else if ( $ immediateObject instanceof SerialisableObject ) { $ immediateObject -> __setSerialisablePropertyValue ( $ memberName , $ value ) ; } }
Set a nested object property value on an object using a member path to locate it.

@param $value
@param $object
@param $memberPath
Set a nested object property value on an object using a member path to locate it .