public function emptyCollection(Request $request, $bas_id)
    {
        $success = false;
        $msg = $this->app->trans('An error occurred');

        $collection = \collection::getByBaseId($this->app, $bas_id);
        try {
            if ($collection->get_record_amount() <= 500) {
                $collection->empty_collection(500);
                $msg = $this->app->trans('Collection empty successful');
            } else {
                $this->app['manipulator.task']->createEmptyCollectionJob($collection);
                $msg = $this->app->trans('A task has been creted, please run it to complete empty collection');
            }

            $success = true;
        } catch (\Exception $e) {

        }

        if ('json' === $request->getRequestFormat()) {
            return $this->app->json([
                'success' => $success,
                'msg'     => $msg,
                'bas_id'  => $collection->get_base_id()
            ]);
        }

        return $this->app->redirectPath('admin_display_collection', [
            'bas_id'  => $collection->get_base_id(),
            'success' => (int) $success,
        ]);
    }
public function emptyCollection(Request $request, $bas_id)
    {
        $success = false;
        $msg = $this->app->trans('An error occurred');

        $collection = \collection::getByBaseId($this->app, $bas_id);
        try {
            if ($collection->get_record_amount() <= 500) {
                $collection->empty_collection(500);
                $msg = $this->app->trans('Collection empty successful');
            } else {
                $this->app['manipulator.task']->createEmptyCollectionJob($collection);
                $msg = $this->app->trans('A task has been creted, please run it to complete empty collection');
            }

            $success = true;
        } catch (\Exception $e) {

        }

        if ('json' === $request->getRequestFormat()) {
            return $this->app->json([
                'success' => $success,
                'msg'     => $msg,
                'bas_id'  => $collection->get_base_id()
            ]);
        }

        return $this->app->redirectPath('admin_display_collection', [
            'bas_id'  => $collection->get_base_id(),
            'success' => (int) $success,
        ]);
    }
public function emptyCollection ( Request $ request , $ bas_id ) { $ success = false ; $ msg = $ this -> app -> trans ( 'An error occurred' ) ; $ collection = \ collection :: getByBaseId ( $ this -> app , $ bas_id ) ; try { if ( $ collection -> get_record_amount ( ) <= 500 ) { $ collection -> empty_collection ( 500 ) ; $ msg = $ this -> app -> trans ( 'Collection empty successful' ) ; } else { $ this -> app [ 'manipulator.task' ] -> createEmptyCollectionJob ( $ collection ) ; $ msg = $ this -> app -> trans ( 'A task has been creted, please run it to complete empty collection' ) ; } $ success = true ; } catch ( \ Exception $ e ) { } if ( 'json' === $ request -> getRequestFormat ( ) ) { return $ this -> app -> json ( [ 'success' => $ success , 'msg' => $ msg , 'bas_id' => $ collection -> get_base_id ( ) ] ) ; } return $ this -> app -> redirectPath ( 'admin_display_collection' , [ 'bas_id' => $ collection -> get_base_id ( ) , 'success' => ( int ) $ success , ] ) ; }
Empty a collection

@param  Request                       $request The current request
@param  integer                       $bas_id  The collection base_id
@return Response
Empty a collection