protected function normalizeData(array $data, $parentId = null) {
        $result = [];
        foreach ($data as $element) {
            if (ArrayHelper::getValue($element, $this->parentColumnName) === $parentId) {
                $result[] = $element;
                $children = $this->normalizeData($data, ArrayHelper::getValue($element, $this->keyColumnName));
                if ($children) {
                    $result = array_merge($result, $children);
                }
            }
        }
        return $result;
    }
protected function normalizeData(array $data, $parentId = null) {
        $result = [];
        foreach ($data as $element) {
            if (ArrayHelper::getValue($element, $this->parentColumnName) === $parentId) {
                $result[] = $element;
                $children = $this->normalizeData($data, ArrayHelper::getValue($element, $this->keyColumnName));
                if ($children) {
                    $result = array_merge($result, $children);
                }
            }
        }
        return $result;
    }
protected function normalizeData ( array $ data , $ parentId = null ) { $ result = [ ] ; foreach ( $ data as $ element ) { if ( ArrayHelper :: getValue ( $ element , $ this -> parentColumnName ) === $ parentId ) { $ result [ ] = $ element ; $ children = $ this -> normalizeData ( $ data , ArrayHelper :: getValue ( $ element , $ this -> keyColumnName ) ) ; if ( $ children ) { $ result = array_merge ( $ result , $ children ) ; } } } return $ result ; }
Normalize tree data
@param array $data
@param string $parentId
@return array
Normalize tree data