src/Graviton/SchemaBundle/Constraint/RecordOriginConstraint.php
private function addProperties($expression, $obj)
    {
        $val = &$obj;
        $parts = explode('.', $expression);
        $numParts = count($parts);

        if ($numParts == 1) {
            $val->{$parts[0]} = null;
        } else {
            $iteration = 1;
            foreach ($parts as $part) {
                if ($iteration < $numParts) {
                    if (!isset($val->{$part}) || !is_object($val->{$part})) {
                        $val->{$part} = new \stdClass();
                    }
                    $val = &$val->{$part};
                } else {
                    $val->{$part} = null;
                }
                $iteration++;
            }
        }

        return $val;
    }
private function addProperties($expression, $obj)
    {
        $val = &$obj;
        $parts = explode('.', $expression);
        $numParts = count($parts);

        if ($numParts == 1) {
            $val->{$parts[0]} = null;
        } else {
            $iteration = 1;
            foreach ($parts as $part) {
                if ($iteration < $numParts) {
                    if (!isset($val->{$part}) || !is_object($val->{$part})) {
                        $val->{$part} = new \stdClass();
                    }
                    $val = &$val->{$part};
                } else {
                    $val->{$part} = null;
                }
                $iteration++;
            }
        }

        return $val;
    }
private function addProperties ( $ expression , $ obj ) { $ val = & $ obj ; $ parts = explode ( '.' , $ expression ) ; $ numParts = count ( $ parts ) ; if ( $ numParts == 1 ) { $ val -> { $ parts [ 0 ] } = null ; } else { $ iteration = 1 ; foreach ( $ parts as $ part ) { if ( $ iteration < $ numParts ) { if ( ! isset ( $ val -> { $ part } ) || ! is_object ( $ val -> { $ part } ) ) { $ val -> { $ part } = new \ stdClass ( ) ; } $ val = & $ val -> { $ part } ; } else { $ val -> { $ part } = null ; } $ iteration ++ ; } } return $ val ; }
if the user provides properties that are in the exception list but not on the currently saved
object, we try here to synthetically add them to our representation. and yes, this won't support
exclusions in an array structure for the moment, but that is also not needed for now.

@param string $expression the expression
@param object $obj        the object

@return object the modified object
if the user provides properties that are in the exception list but not on the currently saved object we try here to synthetically add them to our representation . and yes this won t support exclusions in an array structure for the moment but that is also not needed for now .