protected function _validates($options)
    {
        $defaults = ['embed' => true];
        $options += $defaults;

        if ($options['embed'] === true) {
            $options['embed'] = $this->hierarchy();
        }

        $schema = $this->schema();
        $tree = $schema->treeify($options['embed']);
        $success = true;

        foreach ($tree as $field => $value) {
            if (isset($this->{$field})) {
                $rel = $schema->relation($field);
                $success = $success && $rel->validates($this, $value ? $value + $options : $options);
            }
        }
        return $success;
    }
protected function _validates($options)
    {
        $defaults = ['embed' => true];
        $options += $defaults;

        if ($options['embed'] === true) {
            $options['embed'] = $this->hierarchy();
        }

        $schema = $this->schema();
        $tree = $schema->treeify($options['embed']);
        $success = true;

        foreach ($tree as $field => $value) {
            if (isset($this->{$field})) {
                $rel = $schema->relation($field);
                $success = $success && $rel->validates($this, $value ? $value + $options : $options);
            }
        }
        return $success;
    }
protected function _validates ( $ options ) { $ defaults = [ 'embed' => true ] ; $ options += $ defaults ; if ( $ options [ 'embed' ] === true ) { $ options [ 'embed' ] = $ this -> hierarchy ( ) ; } $ schema = $ this -> schema ( ) ; $ tree = $ schema -> treeify ( $ options [ 'embed' ] ) ; $ success = true ; foreach ( $ tree as $ field => $ value ) { if ( isset ( $ this -> { $ field } ) ) { $ rel = $ schema -> relation ( $ field ) ; $ success = $ success && $ rel -> validates ( $ this , $ value ? $ value + $ options : $ options ) ; } } return $ success ; }
Check if nested relations are valid.

@param  array   $options Available options:
- `'embed'` _array_ : List of relations to validate.
@return boolean          Returns `true` if all validation rules on all fields succeed, `false` otherwise.
Check if nested relations are valid .