public function clearBlocks($skipRepeated = true)
    {
        try {
            $result = null;
            $this->dispatcher->dispatch(Content\TemplateManagerEvents::BEFORE_CLEAR_BLOCKS, new Content\TemplateManager\BeforeClearBlocksEvent($this));

            $this->blockRepository->startTransaction();
            foreach ($this->slotManagers as $slotManager) {
                if ($skipRepeated && $slotManager->getSlot()->getRepeated() != 'page') {
                    continue;
                }
                $result = $slotManager->deleteBlocks();

                if (false === $result) {
                    break;
                }
            }

            $this->dispatcher->dispatch(Content\TemplateManagerEvents::BEFORE_CLEAR_BLOCKS_COMMIT, new Content\TemplateManager\BeforeClearBlocksCommitEvent($this));

            if ($result !== false) {
                $this->blockRepository->commit();
            } else {
                $this->blockRepository->rollBack();
            }

            $this->dispatcher->dispatch(Content\TemplateManagerEvents::AFTER_CLEAR_BLOCKS, new Content\TemplateManager\AfterClearBlocksEvent($this));

            return $result;
        } catch (\Exception $e) {
            $this->blockRepository->rollBack();

            throw $e;
        }
    }
public function clearBlocks($skipRepeated = true)
    {
        try {
            $result = null;
            $this->dispatcher->dispatch(Content\TemplateManagerEvents::BEFORE_CLEAR_BLOCKS, new Content\TemplateManager\BeforeClearBlocksEvent($this));

            $this->blockRepository->startTransaction();
            foreach ($this->slotManagers as $slotManager) {
                if ($skipRepeated && $slotManager->getSlot()->getRepeated() != 'page') {
                    continue;
                }
                $result = $slotManager->deleteBlocks();

                if (false === $result) {
                    break;
                }
            }

            $this->dispatcher->dispatch(Content\TemplateManagerEvents::BEFORE_CLEAR_BLOCKS_COMMIT, new Content\TemplateManager\BeforeClearBlocksCommitEvent($this));

            if ($result !== false) {
                $this->blockRepository->commit();
            } else {
                $this->blockRepository->rollBack();
            }

            $this->dispatcher->dispatch(Content\TemplateManagerEvents::AFTER_CLEAR_BLOCKS, new Content\TemplateManager\AfterClearBlocksEvent($this));

            return $result;
        } catch (\Exception $e) {
            $this->blockRepository->rollBack();

            throw $e;
        }
    }
public function clearBlocks ( $ skipRepeated = true ) { try { $ result = null ; $ this -> dispatcher -> dispatch ( Content \ TemplateManagerEvents :: BEFORE_CLEAR_BLOCKS , new Content \ TemplateManager \ BeforeClearBlocksEvent ( $ this ) ) ; $ this -> blockRepository -> startTransaction ( ) ; foreach ( $ this -> slotManagers as $ slotManager ) { if ( $ skipRepeated && $ slotManager -> getSlot ( ) -> getRepeated ( ) != 'page' ) { continue ; } $ result = $ slotManager -> deleteBlocks ( ) ; if ( false === $ result ) { break ; } } $ this -> dispatcher -> dispatch ( Content \ TemplateManagerEvents :: BEFORE_CLEAR_BLOCKS_COMMIT , new Content \ TemplateManager \ BeforeClearBlocksCommitEvent ( $ this ) ) ; if ( $ result !== false ) { $ this -> blockRepository -> commit ( ) ; } else { $ this -> blockRepository -> rollBack ( ) ; } $ this -> dispatcher -> dispatch ( Content \ TemplateManagerEvents :: AFTER_CLEAR_BLOCKS , new Content \ TemplateManager \ AfterClearBlocksEvent ( $ this ) ) ; return $ result ; } catch ( \ Exception $ e ) { $ this -> blockRepository -> rollBack ( ) ; throw $ e ; } }
Removes the blocks from the whole slot managers managed by the template manager

@param  boolean    $skipRepeated When true skips the slots with a repeated status
@return boolean
@throws \Exception

@api
Removes the blocks from the whole slot managers managed by the template manager