public function treeify($embed)
    {
        if (!$embed) {
            return [];
        }
        $embed = Set::expand(Set::normalize((array) $embed), ['affix' => 'embed']);

        $result = [];
        foreach ($embed as $relName => $value) {
            if (!isset($this->_relations[$relName])) {
                continue;
            }
            if ($this->_relations[$relName]['relation'] === 'hasManyThrough') {
                $rel = $this->relation($relName);
                if (!isset($result[$rel->through()]['embed'][$rel->using()])) {
                    $result[$rel->through()]['embed'][$rel->using()] = $value;
                }
            }
            $result[$relName] = $value;
        }
        return $result;
    }
public function treeify($embed)
    {
        if (!$embed) {
            return [];
        }
        $embed = Set::expand(Set::normalize((array) $embed), ['affix' => 'embed']);

        $result = [];
        foreach ($embed as $relName => $value) {
            if (!isset($this->_relations[$relName])) {
                continue;
            }
            if ($this->_relations[$relName]['relation'] === 'hasManyThrough') {
                $rel = $this->relation($relName);
                if (!isset($result[$rel->through()]['embed'][$rel->using()])) {
                    $result[$rel->through()]['embed'][$rel->using()] = $value;
                }
            }
            $result[$relName] = $value;
        }
        return $result;
    }
public function treeify ( $ embed ) { if ( ! $ embed ) { return [ ] ; } $ embed = Set :: expand ( Set :: normalize ( ( array ) $ embed ) , [ 'affix' => 'embed' ] ) ; $ result = [ ] ; foreach ( $ embed as $ relName => $ value ) { if ( ! isset ( $ this -> _relations [ $ relName ] ) ) { continue ; } if ( $ this -> _relations [ $ relName ] [ 'relation' ] === 'hasManyThrough' ) { $ rel = $ this -> relation ( $ relName ) ; if ( ! isset ( $ result [ $ rel -> through ( ) ] [ 'embed' ] [ $ rel -> using ( ) ] ) ) { $ result [ $ rel -> through ( ) ] [ 'embed' ] [ $ rel -> using ( ) ] = $ value ; } } $ result [ $ relName ] = $ value ; } return $ result ; }
Returns a nested tree representation of `'embed'` option.

@return array The corresponding nested tree representation.
Returns a nested tree representation of embed option .