Sulu\Bundle\CategoryBundle\Command\RecoverCommand::fixWrongDepthGap PHP Метод

fixWrongDepthGap() приватный Метод

Fix categories where difference to parents depth.
private fixWrongDepthGap ( ) : integer | boolean
Результат integer | boolean Number of affected rows
    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->getEntityManager()->getConnection()->prepare($sql);
        if ($statement->execute()) {
            return $statement->rowCount();
        }
        return false;
    }