public function exportAction()
    {
        $params         = $this->params();
        $paragraphId    = $params->fromRoute( 'paragraphId' );
        $serviceLocator = $this->getServiceLocator();
        $paragraphModel = $serviceLocator->get( 'Grid\Paragraph\Model\Paragraph\Model' );
        $paragraph      = $paragraphModel->find( $paragraphId );

        if ( empty( $paragraph ) )
        {
            $this->getResponse()
                 ->setResultCode( 404 );

            return;
        }

        $zipFile = $serviceLocator->get( 'Grid\Customize\Model\Exporter' )
                                  ->export( $paragraph->id );

        $name = strtolower( $paragraph->name );

        if ( empty( $name ) )
        {
            $name = 'paragraph-' . $paragraph->id;
        }

        $response = Readfile::fromFile(
            $zipFile,
            'application/zip',
            $name . '.zip',
            true
        );

        $this->getEvent()
             ->setResponse( $response );

        return $response;
    }
public function exportAction()
    {
        $params         = $this->params();
        $paragraphId    = $params->fromRoute( 'paragraphId' );
        $serviceLocator = $this->getServiceLocator();
        $paragraphModel = $serviceLocator->get( 'Grid\Paragraph\Model\Paragraph\Model' );
        $paragraph      = $paragraphModel->find( $paragraphId );

        if ( empty( $paragraph ) )
        {
            $this->getResponse()
                 ->setResultCode( 404 );

            return;
        }

        $zipFile = $serviceLocator->get( 'Grid\Customize\Model\Exporter' )
                                  ->export( $paragraph->id );

        $name = strtolower( $paragraph->name );

        if ( empty( $name ) )
        {
            $name = 'paragraph-' . $paragraph->id;
        }

        $response = Readfile::fromFile(
            $zipFile,
            'application/zip',
            $name . '.zip',
            true
        );

        $this->getEvent()
             ->setResponse( $response );

        return $response;
    }
public function exportAction ( ) { $ params = $ this -> params ( ) ; $ paragraphId = $ params -> fromRoute ( 'paragraphId' ) ; $ serviceLocator = $ this -> getServiceLocator ( ) ; $ paragraphModel = $ serviceLocator -> get ( 'Grid\Paragraph\Model\Paragraph\Model' ) ; $ paragraph = $ paragraphModel -> find ( $ paragraphId ) ; if ( empty ( $ paragraph ) ) { $ this -> getResponse ( ) -> setResultCode ( 404 ) ; return ; } $ zipFile = $ serviceLocator -> get ( 'Grid\Customize\Model\Exporter' ) -> export ( $ paragraph -> id ) ; $ name = strtolower ( $ paragraph -> name ) ; if ( empty ( $ name ) ) { $ name = 'paragraph-' . $ paragraph -> id ; } $ response = Readfile :: fromFile ( $ zipFile , 'application/zip' , $ name . '.zip' , true ) ; $ this -> getEvent ( ) -> setResponse ( $ response ) ; return $ response ; }
Export paragraph action
Export paragraph action