original_string: 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;
      }
code: 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;
      }
code_tokens: 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 ; }
docstring: Export paragraph action
docstring_tokens: Export paragraph action