src/Sulu/Bundle/CategoryBundle/Command/RecoverCommand.php
private function fixWrongDepthGap()
    {
        // FIXME: convert this native query to DQL (once its possible to join within UPDATE statement)
        // fix categories where difference to parents depth > 1
        $sql = 'UPDATE ca_categories c2
                JOIN ca_categories c1 ON c2.idCategoriesParent = c1.id
                SET c2.depth = (c1.depth + 1)
                WHERE ( c2.depth - 1 ) <> c1.depth';

        $statement = $this->entityManager->getConnection()->prepare($sql);
        if ($statement->execute()) {
            return $statement->rowCount();
        }

        return false;
    }
private function fixWrongDepthGap()
    {
        // FIXME: convert this native query to DQL (once its possible to join within UPDATE statement)
        // fix categories where difference to parents depth > 1
        $sql = 'UPDATE ca_categories c2
                JOIN ca_categories c1 ON c2.idCategoriesParent = c1.id
                SET c2.depth = (c1.depth + 1)
                WHERE ( c2.depth - 1 ) <> c1.depth';

        $statement = $this->entityManager->getConnection()->prepare($sql);
        if ($statement->execute()) {
            return $statement->rowCount();
        }

        return false;
    }
private function fixWrongDepthGap ( ) { // FIXME: convert this native query to DQL (once its possible to join within UPDATE statement) // fix categories where difference to parents depth > 1 $ sql = 'UPDATE ca_categories c2
                JOIN ca_categories c1 ON c2.idCategoriesParent = c1.id
                SET c2.depth = (c1.depth + 1)
                WHERE ( c2.depth - 1 ) <> c1.depth' ; $ statement = $ this -> entityManager -> getConnection ( ) -> prepare ( $ sql ) ; if ( $ statement -> execute ( ) ) { return $ statement -> rowCount ( ) ; } return false ; }
Fix categories where difference to parents depth.

@return int|bool Number of affected rows
Fix categories where difference to parents depth .