예제 #1
0
 /**
  * Theme install screen.
  *
  * @param Symfony\Component\HttpFoundation\Request $request
  *
  * @return Symfony\Component\HttpFoundation\Response
  */
 public function themesAction(Request $request)
 {
     $infosForm = $this->buildInformationsForm($request);
     if ($infosForm !== null) {
         $infosForm->handleRequest($request);
         if ($infosForm->isValid()) {
             /*
              * Save informations
              */
             try {
                 $fixtures = new Fixtures($this->getService("em"));
                 $fixtures->saveInformations($infosForm->getData());
                 if (!empty($infosForm->getData()["install_theme"])) {
                     /*
                      * Force redirect to avoid resending form when refreshing page
                      */
                     return $this->redirect($this->generateUrl('installThemeSummaryPage', ['classname' => $infosForm->getData()['className']]));
                 } else {
                     return $this->redirect($this->generateUrl('installUserPage'));
                 }
             } catch (\Exception $e) {
                 $this->assignation['error'] = true;
                 $this->assignation['errorMessage'] = $e->getMessage() . PHP_EOL . $e->getTraceAsString();
             }
         }
         $this->assignation['infosForm'] = $infosForm->createView();
     }
     return $this->render('steps/themes.html.twig', $this->assignation);
 }