private function hierarchyToFlatArray($items) {
        $flatArray = [];
        foreach($items as $item) {
            $flatArray[] = $item->getId();
            // TODO generalize
            if($items->getChildren()->count() > 0) {
                $flatArray = array_merge($flatArray, $this->hierarchyToFlatArray($items->getChildren()));
            }
        }
        return $flatArray;
    }
private function hierarchyToFlatArray($items) {
        $flatArray = [];
        foreach($items as $item) {
            $flatArray[] = $item->getId();
            // TODO generalize
            if($items->getChildren()->count() > 0) {
                $flatArray = array_merge($flatArray, $this->hierarchyToFlatArray($items->getChildren()));
            }
        }
        return $flatArray;
    }
private function hierarchyToFlatArray ( $ items ) { $ flatArray = [ ] ; foreach ( $ items as $ item ) { $ flatArray [ ] = $ item -> getId ( ) ; // TODO generalize if ( $ items -> getChildren ( ) -> count ( ) > 0 ) { $ flatArray = array_merge ( $ flatArray , $ this -> hierarchyToFlatArray ( $ items -> getChildren ( ) ) ) ; } } return $ flatArray ; }
Transform hierarchical list to flat array for easing comparison
@param $items
@return array
Transform hierarchical list to flat array for easing comparison