protected function finish()
 {
     $this->_em->flush();
     $uploader = new Upload($this->file, 'sportmaster');
     $zipPath = (new Zip())->pack($uploader->upload());
     $user = $this->_container->get('security.context')->getToken()->getUser();
     $this->saveImportLog($this->getImportName(), $this->getMessageService()->dumpAsHtml(), self::STATUS_OK, $user, '+6 month', $zipPath);
 }
Exemplo n.º 2
0
 public function spmInterfaceLogAction(Request $request)
 {
     $form = $this->createForm(new Upload(Upload::TYPE_CSV));
     $form->handleRequest($request);
     if ($request->isMethod('POST')) {
         if ($form->isValid()) {
             $file = $form->get('file')->getData();
             $uploader = new Uploader($file, SportmasterBundle::getBundleName());
             try {
                 $filePath = $uploader->upload();
                 $importService = new ImportSpmInterfaceLog($filePath, $this->container);
                 $importService->parse();
                 $request->getSession()->getFlashBag()->add('notice', $importService->getMessageService()->dumpAsHtml());
             } catch (\Exception $e) {
                 $request->getSession()->getFlashBag()->add('error', $e->getMessage());
             }
         }
     }
     //log grid
     $grid = $this->get('app_core.importLogGrid')->getImportGrid(ImportSpmInterfaceLog::$importName);
     return $this->render('SportmasterBundle:Import:ref.html.twig', ['header' => 'Import SpmInterfaceLog', 'form' => $form->createView(), 'grid' => $grid]);
 }