Bundle/BlogBundle/Entity/Blog.php
public function getRootCategories()
    {
        $rootCategories = [];
        foreach ($this->categories as $categories) {
            if ($categories->getLvl() == 0) {
                $rootCategories[] = $categories;
            }
        }

        return $rootCategories;
    }
public function getRootCategories()
    {
        $rootCategories = [];
        foreach ($this->categories as $categories) {
            if ($categories->getLvl() == 0) {
                $rootCategories[] = $categories;
            }
        }

        return $rootCategories;
    }
public function getRootCategories ( ) { $ rootCategories = [ ] ; foreach ( $ this -> categories as $ categories ) { if ( $ categories -> getLvl ( ) == 0 ) { $ rootCategories [ ] = $ categories ; } } return $ rootCategories ; }
Get root categories.

@return string
Get root categories .