public function build(array $data)
    {
        $relations = array(
            self::TREE_PARAM_ITEMS => array(),
            self::TREE_PARAM_PARENTS => array()
        );

        foreach ($data as $row) {
            $relations[self::TREE_PARAM_ITEMS][$row[self::TREE_PARAM_ID]] = $row;
            $relations[self::TREE_PARAM_PARENTS][$row[self::TREE_PARAM_PARENT_ID]][] = $row[self::TREE_PARAM_ID];
        }

        return $relations;
    }
public function build(array $data)
    {
        $relations = array(
            self::TREE_PARAM_ITEMS => array(),
            self::TREE_PARAM_PARENTS => array()
        );

        foreach ($data as $row) {
            $relations[self::TREE_PARAM_ITEMS][$row[self::TREE_PARAM_ID]] = $row;
            $relations[self::TREE_PARAM_PARENTS][$row[self::TREE_PARAM_PARENT_ID]][] = $row[self::TREE_PARAM_ID];
        }

        return $relations;
    }
public function build ( array $ data ) { $ relations = array ( self :: TREE_PARAM_ITEMS => array ( ) , self :: TREE_PARAM_PARENTS => array ( ) ) ; foreach ( $ data as $ row ) { $ relations [ self :: TREE_PARAM_ITEMS ] [ $ row [ self :: TREE_PARAM_ID ] ] = $ row ; $ relations [ self :: TREE_PARAM_PARENTS ] [ $ row [ self :: TREE_PARAM_PARENT_ID ] ] [ ] = $ row [ self :: TREE_PARAM_ID ] ; } return $ relations ; }
Builds a relational tree

@param array $data Raw data
@return array
Builds a relational tree