protected function deleteCategories()
    {
        $categoryEntityTable = $this->resourceFactory->create()->getEntityTable();

        while ($bunch = $this->_dataSourceModel->getNextBunch()) {
            $idToDelete = [];

            foreach ($bunch as $rowNum => $rowData) {
                $this->filterRowData($rowData);
                if ($this->validateRow($rowData, $rowNum) && self::SCOPE_DEFAULT == $this->getRowScope($rowData)) {
                    $idToDelete[] = $this->categoriesWithRoots[$rowData[self::COL_ROOT]][$rowData[self::COL_CATEGORY]]['entity_id'];
                }
            }
            if ($idToDelete) {
                $this->countItemsDeleted += count($idToDelete);
                $this->transactionManager->start($this->_connection);
                try {
                    $this->objectRelationProcessor->delete(
                        $this->transactionManager,
                        $this->_connection,
                        $categoryEntityTable,
                        $this->_connection->quoteInto('entity_id IN (?)', $idToDelete),
                        ['entity_id' => $idToDelete]
                    );
                    $this->transactionManager->commit();
                } catch (\Exception $e) {
                    $this->transactionManager->rollBack();
                    throw $e;
                }
                $this->eventManager->dispatch('catalog_category_import_bunch_delete_after', ['adapter' => $this, 'bunch' => $bunch]);
            }
        }

        return $this;
    }
protected function deleteCategories()
    {
        $categoryEntityTable = $this->resourceFactory->create()->getEntityTable();

        while ($bunch = $this->_dataSourceModel->getNextBunch()) {
            $idToDelete = [];

            foreach ($bunch as $rowNum => $rowData) {
                $this->filterRowData($rowData);
                if ($this->validateRow($rowData, $rowNum) && self::SCOPE_DEFAULT == $this->getRowScope($rowData)) {
                    $idToDelete[] = $this->categoriesWithRoots[$rowData[self::COL_ROOT]][$rowData[self::COL_CATEGORY]]['entity_id'];
                }
            }
            if ($idToDelete) {
                $this->countItemsDeleted += count($idToDelete);
                $this->transactionManager->start($this->_connection);
                try {
                    $this->objectRelationProcessor->delete(
                        $this->transactionManager,
                        $this->_connection,
                        $categoryEntityTable,
                        $this->_connection->quoteInto('entity_id IN (?)', $idToDelete),
                        ['entity_id' => $idToDelete]
                    );
                    $this->transactionManager->commit();
                } catch (\Exception $e) {
                    $this->transactionManager->rollBack();
                    throw $e;
                }
                $this->eventManager->dispatch('catalog_category_import_bunch_delete_after', ['adapter' => $this, 'bunch' => $bunch]);
            }
        }

        return $this;
    }
protected function deleteCategories ( ) { $ categoryEntityTable = $ this -> resourceFactory -> create ( ) -> getEntityTable ( ) ; while ( $ bunch = $ this -> _dataSourceModel -> getNextBunch ( ) ) { $ idToDelete = [ ] ; foreach ( $ bunch as $ rowNum => $ rowData ) { $ this -> filterRowData ( $ rowData ) ; if ( $ this -> validateRow ( $ rowData , $ rowNum ) && self :: SCOPE_DEFAULT == $ this -> getRowScope ( $ rowData ) ) { $ idToDelete [ ] = $ this -> categoriesWithRoots [ $ rowData [ self :: COL_ROOT ] ] [ $ rowData [ self :: COL_CATEGORY ] ] [ 'entity_id' ] ; } } if ( $ idToDelete ) { $ this -> countItemsDeleted += count ( $ idToDelete ) ; $ this -> transactionManager -> start ( $ this -> _connection ) ; try { $ this -> objectRelationProcessor -> delete ( $ this -> transactionManager , $ this -> _connection , $ categoryEntityTable , $ this -> _connection -> quoteInto ( 'entity_id IN (?)' , $ idToDelete ) , [ 'entity_id' => $ idToDelete ] ) ; $ this -> transactionManager -> commit ( ) ; } catch ( \ Exception $ e ) { $ this -> transactionManager -> rollBack ( ) ; throw $ e ; } $ this -> eventManager -> dispatch ( 'catalog_category_import_bunch_delete_after' , [ 'adapter' => $ this , 'bunch' => $ bunch ] ) ; } } return $ this ; }
Delete categories.

@return $this
@throws \Exception
Delete categories .