public function downloadExecute(Token $token)
    {
        if (false === $list = @unserialize($token->getData())) {
            return $this->app->json([
                'success' => false,
                'message' => 'Invalid datas'
            ]);
        }

        set_time_limit(0);
        // Force the session to be saved and closed.
        /** @var Session $session */
        $session = $this->app['session'];
        $session->save();
        ignore_user_abort(true);

        if ($list['count'] > 1) {
            \set_export::build_zip(
                $this->app,
                $token,
                $list,
                sprintf('%s/%s.zip', $this->app['tmp.download.path'], $token->getValue()) // Dest file
            );
        } else {
            $list['complete'] = true;
            $token->setData(serialize($list));
            /** @var EntityManagerInterface $manager */
            $manager = $this->app['orm.em'];
            $manager->persist($token);
            $manager->flush();
        }

        return $this->app->json([
            'success' => true,
            'message' => ''
        ]);
    }
public function downloadExecute(Token $token)
    {
        if (false === $list = @unserialize($token->getData())) {
            return $this->app->json([
                'success' => false,
                'message' => 'Invalid datas'
            ]);
        }

        set_time_limit(0);
        // Force the session to be saved and closed.
        /** @var Session $session */
        $session = $this->app['session'];
        $session->save();
        ignore_user_abort(true);

        if ($list['count'] > 1) {
            \set_export::build_zip(
                $this->app,
                $token,
                $list,
                sprintf('%s/%s.zip', $this->app['tmp.download.path'], $token->getValue()) // Dest file
            );
        } else {
            $list['complete'] = true;
            $token->setData(serialize($list));
            /** @var EntityManagerInterface $manager */
            $manager = $this->app['orm.em'];
            $manager->persist($token);
            $manager->flush();
        }

        return $this->app->json([
            'success' => true,
            'message' => ''
        ]);
    }
public function downloadExecute ( Token $ token ) { if ( false === $ list = @ unserialize ( $ token -> getData ( ) ) ) { return $ this -> app -> json ( [ 'success' => false , 'message' => 'Invalid datas' ] ) ; } set_time_limit ( 0 ) ; // Force the session to be saved and closed. /** @var Session $session */ $ session = $ this -> app [ 'session' ] ; $ session -> save ( ) ; ignore_user_abort ( true ) ; if ( $ list [ 'count' ] > 1 ) { \ set_export :: build_zip ( $ this -> app , $ token , $ list , sprintf ( '%s/%s.zip' , $ this -> app [ 'tmp.download.path' ] , $ token -> getValue ( ) ) // Dest file ) ; } else { $ list [ 'complete' ] = true ; $ token -> setData ( serialize ( $ list ) ) ; /** @var EntityManagerInterface $manager */ $ manager = $ this -> app [ 'orm.em' ] ; $ manager -> persist ( $ token ) ; $ manager -> flush ( ) ; } return $ this -> app -> json ( [ 'success' => true , 'message' => '' ] ) ; }
Build a zip of downloaded documents

@param Token       $token

@return Response
Build a zip of downloaded documents