src/ScContent/Listener/Back/ContentListClean.php
public function process(EventInterface $event)
    {
        $events = $this->getEventManager();
        $mapper = $this->getMapper();
        $optionsProvider = $this->getOptionsProvider();
        $translator = $this->getTranslator();
        $pane = $event->getParam('pane');
        if (! $optionsProvider->hasIdentifier($pane)) {
            return;
        }
        $options = $optionsProvider->getOptions($pane);
        if ($options->getType() == 'search' || $options->getRoot() == 'site') {
            return;
        }
        try {
            $mapper->beginTransaction();
            $tid = $mapper->getTransactionIdentifier();
            $events->trigger(
                __FUNCTION__ . '.clean.pre',
                null,
                [
                    'tid' => $tid,
                ]
            );
            $mapper->clean($tid);
            $mapper->commit();
        } catch (Exception $e) {
            if (DEBUG_MODE) {
                throw new DebugException(
                    $translator->translate('Error: ') . $e->getMessage(),
                    $e->getCode(),
                    $e
                );
            }
            $meta = $mapper->findMetaById($id);
            $name = isset($meta['title']) ? $meta['title'] : $id;
            $this->setValue($name)->error(self::UnexpectedError);
        }

        return $this->redirect($event, 'sc-admin/file/delete');
    }
public function process(EventInterface $event)
    {
        $events = $this->getEventManager();
        $mapper = $this->getMapper();
        $optionsProvider = $this->getOptionsProvider();
        $translator = $this->getTranslator();
        $pane = $event->getParam('pane');
        if (! $optionsProvider->hasIdentifier($pane)) {
            return;
        }
        $options = $optionsProvider->getOptions($pane);
        if ($options->getType() == 'search' || $options->getRoot() == 'site') {
            return;
        }
        try {
            $mapper->beginTransaction();
            $tid = $mapper->getTransactionIdentifier();
            $events->trigger(
                __FUNCTION__ . '.clean.pre',
                null,
                [
                    'tid' => $tid,
                ]
            );
            $mapper->clean($tid);
            $mapper->commit();
        } catch (Exception $e) {
            if (DEBUG_MODE) {
                throw new DebugException(
                    $translator->translate('Error: ') . $e->getMessage(),
                    $e->getCode(),
                    $e
                );
            }
            $meta = $mapper->findMetaById($id);
            $name = isset($meta['title']) ? $meta['title'] : $id;
            $this->setValue($name)->error(self::UnexpectedError);
        }

        return $this->redirect($event, 'sc-admin/file/delete');
    }
public function process ( EventInterface $ event ) { $ events = $ this -> getEventManager ( ) ; $ mapper = $ this -> getMapper ( ) ; $ optionsProvider = $ this -> getOptionsProvider ( ) ; $ translator = $ this -> getTranslator ( ) ; $ pane = $ event -> getParam ( 'pane' ) ; if ( ! $ optionsProvider -> hasIdentifier ( $ pane ) ) { return ; } $ options = $ optionsProvider -> getOptions ( $ pane ) ; if ( $ options -> getType ( ) == 'search' || $ options -> getRoot ( ) == 'site' ) { return ; } try { $ mapper -> beginTransaction ( ) ; $ tid = $ mapper -> getTransactionIdentifier ( ) ; $ events -> trigger ( __FUNCTION__ . '.clean.pre' , null , [ 'tid' => $ tid , ] ) ; $ mapper -> clean ( $ tid ) ; $ mapper -> commit ( ) ; } catch ( Exception $ e ) { if ( DEBUG_MODE ) { throw new DebugException ( $ translator -> translate ( 'Error: ' ) . $ e -> getMessage ( ) , $ e -> getCode ( ) , $ e ) ; } $ meta = $ mapper -> findMetaById ( $ id ) ; $ name = isset ( $ meta [ 'title' ] ) ? $ meta [ 'title' ] : $ id ; $ this -> setValue ( $ name ) -> error ( self :: UnexpectedError ) ; } return $ this -> redirect ( $ event , 'sc-admin/file/delete' ) ; }
Emptying the trash

@param  \Zend\EventManager\EventInterface $event
@return null|\Zend\Http\Response
Emptying the trash