src/Sulu/Bundle/CategoryBundle/Command/RecoverCommand.php
private function fixCategoriesWithoutParents()
    {
        // fix categories that have no parent but depth > 0
        $qb = $this->categoryRepository->createQueryBuilder('c2')
            ->update()
            ->set('c2.depth', 0)
            ->where('c2.parent IS NULL AND c2.depth != 0');

        $qb->getQuery()->execute();
    }
private function fixCategoriesWithoutParents()
    {
        // fix categories that have no parent but depth > 0
        $qb = $this->categoryRepository->createQueryBuilder('c2')
            ->update()
            ->set('c2.depth', 0)
            ->where('c2.parent IS NULL AND c2.depth != 0');

        $qb->getQuery()->execute();
    }
private function fixCategoriesWithoutParents ( ) { // fix categories that have no parent but depth > 0 $ qb = $ this -> categoryRepository -> createQueryBuilder ( 'c2' ) -> update ( ) -> set ( 'c2.depth' , 0 ) -> where ( 'c2.parent IS NULL AND c2.depth != 0' ) ; $ qb -> getQuery ( ) -> execute ( ) ; }
Set every category where depth > 0 and has no parents to depth 0.
Set every category where depth > 0 and has no parents to depth 0 .