execute() public method

We will build the class name, require the class and call the execute method
public execute ( )
コード例 #1
0
ファイル: Ajax.php プロジェクト: forkcms/forkcms
 /**
  * This method exists because the service container needs to be set before
  * the request's functionality gets loaded.
  */
 public function initialize()
 {
     $request = $this->getContainer()->get('request');
     // get vars
     if ($request->request->has('fork')) {
         $post = $request->request->get('fork');
         $module = isset($post['module']) ? $post['module'] : '';
         $action = isset($post['action']) ? $post['action'] : '';
         $language = isset($post['language']) ? $post['language'] : '';
     } else {
         $module = $request->query->get('module');
         $action = $request->query->get('action');
         $language = $request->query->get('language');
     }
     if ($language == '') {
         $language = SITE_DEFAULT_LANGUAGE;
     }
     try {
         $this->setModule($module);
         $this->setAction($action);
         $this->setLanguage($language);
         if (extension_loaded('newrelic')) {
             newrelic_name_transaction('ajax::' . $module . '::' . $action);
         }
         $this->ajaxAction = new AjaxAction($this->getKernel(), $this->getAction(), $this->getModule());
         $this->output = $this->ajaxAction->execute();
     } catch (InvalidArgumentException $e) {
         $message = Model::getContainer()->getParameter('fork.debug_message');
         $this->ajaxAction = new FrontendBaseAJAXAction($this->getKernel(), '', '');
         $this->ajaxAction->output(FrontendBaseAJAXAction::ERROR, null, $message);
         $this->output = $this->ajaxAction->execute();
     } catch (Exception $e) {
         if (Model::getContainer()->getParameter('kernel.debug')) {
             $message = $e->getMessage();
         } else {
             $message = Model::getContainer()->getParameter('fork.debug_message');
         }
         $this->ajaxAction = new FrontendBaseAJAXAction($this->getKernel(), '', '');
         $this->ajaxAction->output(FrontendBaseAJAXAction::ERROR, null, $message);
         $this->output = $this->ajaxAction->execute();
     }
 }
コード例 #2
0
ファイル: Ajax.php プロジェクト: newaltcoin/forkcms
 /**
  * This method exists because the service container needs to be set before
  * the request's functionality gets loaded.
  */
 public function initialize()
 {
     // get vars
     $module = isset($_POST['fork']['module']) ? $_POST['fork']['module'] : '';
     if ($module == '' && isset($_GET['module'])) {
         $module = $_GET['module'];
     }
     $action = isset($_POST['fork']['action']) ? $_POST['fork']['action'] : '';
     if ($action == '' && isset($_GET['action'])) {
         $action = $_GET['action'];
     }
     $language = isset($_POST['fork']['language']) ? $_POST['fork']['language'] : '';
     if ($language == '' && isset($_GET['language'])) {
         $language = $_GET['language'];
     }
     if ($language == '') {
         $language = SITE_DEFAULT_LANGUAGE;
     }
     try {
         $this->setModule($module);
         $this->setAction($action);
         $this->setLanguage($language);
         if (extension_loaded('newrelic')) {
             newrelic_name_transaction('ajax::' . $module . '::' . $action);
         }
         $this->ajaxAction = new AjaxAction($this->getKernel(), $this->getAction(), $this->getModule());
         $this->output = $this->ajaxAction->execute();
     } catch (Exception $e) {
         if (Model::getContainer()->getParameter('kernel.debug')) {
             $message = $e->getMessage();
         } else {
             $message = Model::getContainer()->getParameter('fork.debug_message');
         }
         $this->ajaxAction = new FrontendBaseAJAXAction($this->getKernel(), '', '');
         $this->ajaxAction->output(FrontendBaseAJAXAction::ERROR, null, $message);
         $this->output = $this->ajaxAction->execute();
     }
 }