protected function deleteBlocks()
    {
        $blocks = $this->blockRepository->retrieveContentsBySlotName($this->slot->getSlotName());
        if (count($blocks) <= 0) {
            return null;
        }
        try {
            $result = null;

            $this->blockRepository->startTransaction();
            foreach ($blocks as $block) {
                $result = $this->blockRepository
                            ->setRepositoryObject($block)
                            ->delete();

                if(!$result) break;
            }

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

            return $result;
        } catch (\Exception $e) {
            if (isset($this->blockRepository) && $this->blockRepository !== null) {
                $this->blockRepository->rollBack();
            }

            throw $e;
        }
    }
protected function deleteBlocks()
    {
        $blocks = $this->blockRepository->retrieveContentsBySlotName($this->slot->getSlotName());
        if (count($blocks) <= 0) {
            return null;
        }
        try {
            $result = null;

            $this->blockRepository->startTransaction();
            foreach ($blocks as $block) {
                $result = $this->blockRepository
                            ->setRepositoryObject($block)
                            ->delete();

                if(!$result) break;
            }

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

            return $result;
        } catch (\Exception $e) {
            if (isset($this->blockRepository) && $this->blockRepository !== null) {
                $this->blockRepository->rollBack();
            }

            throw $e;
        }
    }
protected function deleteBlocks ( ) { $ blocks = $ this -> blockRepository -> retrieveContentsBySlotName ( $ this -> slot -> getSlotName ( ) ) ; if ( count ( $ blocks ) <= 0 ) { return null ; } try { $ result = null ; $ this -> blockRepository -> startTransaction ( ) ; foreach ( $ blocks as $ block ) { $ result = $ this -> blockRepository -> setRepositoryObject ( $ block ) -> delete ( ) ; if ( ! $ result ) break ; } if ( $ result ) { $ this -> blockRepository -> commit ( ) ; } else { $ this -> blockRepository -> rollBack ( ) ; } return $ result ; } catch ( \ Exception $ e ) { if ( isset ( $ this -> blockRepository ) && $ this -> blockRepository !== null ) { $ this -> blockRepository -> rollBack ( ) ; } throw $ e ; } }
Removes the blocks placed on the current slot from the database

@return null|boolean
@throws \Exception
Removes the blocks placed on the current slot from the database