當前位置: 首頁>>代碼示例>>PHP>>正文


PHP AbstractActionController::dispatch方法代碼示例

本文整理匯總了PHP中Zend\Mvc\Controller\AbstractActionController::dispatch方法的典型用法代碼示例。如果您正苦於以下問題:PHP AbstractActionController::dispatch方法的具體用法?PHP AbstractActionController::dispatch怎麽用?PHP AbstractActionController::dispatch使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend\Mvc\Controller\AbstractActionController的用法示例。


在下文中一共展示了AbstractActionController::dispatch方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: dispatch

 /**
  * {@inheritdoc}
  */
 public function dispatch(RequestInterface $request, ResponseInterface $response = null)
 {
     if (!$request instanceof ConsoleRequest) {
         throw new InvalidArgumentException(sprintf('%s can only dispatch requests in a console environment', get_called_class()));
     }
     return parent::dispatch($request, $response);
 }
開發者ID:zendframework,項目名稱:zend-mvc-console,代碼行數:10,代碼來源:AbstractConsoleController.php

示例2: dispatch

 /**
  * {@inheritdoc}
  * @param RequestInterface $request
  * @param ResponseInterface $response
  * @return mixed|ResponseInterface
  * @throws \RuntimeException
  */
 public function dispatch(RequestInterface $request, ResponseInterface $response = null)
 {
     if (!$request instanceof ConsoleRequest) {
         throw new \RuntimeException('You can use this controller only from a console!');
     }
     return parent::dispatch($request, $response);
 }
開發者ID:rwoverdijk,項目名稱:assetmanager,代碼行數:14,代碼來源:ConsoleController.php

示例3: dispatch

 /**
  * Dispatch is called before the action, using this to make sure any request to the app without an authenticated
  * user is directed to the signin,
  *
  * @param Request $request
  * @param Response $response
  * @return mixed|\Zend\Http\Response|Response
  */
 public function dispatch(Request $request, Response $response = null)
 {
     $this->user = ParseUser::getCurrentUser();
     if (!$this->user or !isset($_SESSION['todo']['user']) or $this->user->getUsername() !== $_SESSION['todo']['user']) {
         return $this->redirect()->toRoute('auth', ['action' => 'signin']);
     }
     return parent::dispatch($request, $response);
     // TODO: Change the autogenerated stub
 }
開發者ID:mkhuramj,項目名稱:ToDo-Web,代碼行數:17,代碼來源:AppController.php

示例4: dispatch

 /**
  * Antes de chamar o metodo original setamos as variaveis que vao para o layout
  * como a cor padrao para o fundo do site.
  * 
  * @param RequestInterface $request
  * @param ResponseInterface $response
  */
 public function dispatch(Request $request, Response $response = null)
 {
     // Verifica permissao de acesso.
     if (!$this->checkAccess($request)) {
         return $this->redirect()->toRoute("ajax/access-denied");
     }
     // Segue ritmo normal do dispatch
     return parent::dispatch($request, $response);
 }
開發者ID:braghimsistemas,項目名稱:zf2lib,代碼行數:16,代碼來源:AbstractAjaxController.php

示例5: dispatch

 function dispatch(Request $request, Response $response = null)
 {
     if (php_sapi_name() == 'cli') {
         return parent::dispatch($request, $response);
     }
     // ensure the singleton is loaded & seeded with DB for code that depends on it
     $this->getServiceLocator()->get('vfsingleton');
     if ($this->thisControllerRequiresLoginToView && !isset($_SESSION['logged_in'])) {
         return $this->redirect()->toRoute('login');
     }
     return parent::dispatch($request, $response);
 }
開發者ID:vehiclefits,項目名稱:admin,代碼行數:12,代碼來源:AbstractController.php

示例6: dispatch

 /**
  * Antes de chamar o metodo original setamos as variaveis que vao para o layout
  * como a cor padrao para o fundo do site.
  * 
  * @param RequestInterface $request
  * @param ResponseInterface $response
  */
 public function dispatch(RequestInterface $request, ResponseInterface $response = null)
 {
     // Gerenciamento de permissao de acesso
     $accessControl = AccessControl::getInstance($this->getModuleName());
     $accessControl->setupPermissions($this->getLogin() ? $this->getLogin()->getFkRole() : Config::getZf2libConfig('roleDefault'), $this->getModuleName());
     // Verifica se usuario tem acesso ao controlador e acao requisitado
     if (!$this->checkAccess()) {
         if (!$this->getLogin()) {
             $module = $this->getModuleName() == 'application' ? '' : $this->getModuleName();
             return $this->redirect()->toUrl('/' . $module . '/auth/login');
         } else {
             // Adiciona mensagem e redireciona
             $this->addLayoutMessage("Acesso negado", Enum\MsgType::WARNING, true);
             return $this->initRedirect();
         }
     }
     // Se houver dados no FIREPHP para serem mostrados
     // que vieram de um redirecionamento.
     Firephp::throwRedirectLog();
     // Segue ritmo normal do dispatch
     return parent::dispatch($request, $response);
 }
開發者ID:braghimsistemas,項目名稱:zf2lib,代碼行數:29,代碼來源:AbstractController.php

示例7: dispatch

 /** {@inheritdoc} */
 public function dispatch(\Zend\Stdlib\RequestInterface $request, \Zend\Stdlib\ResponseInterface $response = null)
 {
     // Fetch client with given ID for actions referring to a particular client
     $action = $this->getEvent()->getRouteMatch()->getParam('action');
     if ($action != 'index' and $action != 'search' and $action != 'import') {
         try {
             $this->_currentClient = $this->_clientManager->getClient($request->getQuery('id'));
         } catch (\RuntimeException $e) {
             // Client does not exist - may happen when URL has become stale.
             $this->flashMessenger()->addErrorMessage('The requested client does not exist.');
             return $this->redirectToRoute('client', 'index');
         }
     }
     return parent::dispatch($request, $response);
 }
開發者ID:patrickpreuss,項目名稱:Braintacle,代碼行數:16,代碼來源:ClientController.php

示例8: dispatch

 public function dispatch(\Zend\Stdlib\RequestInterface $request, \Zend\Stdlib\ResponseInterface $response = null)
 {
     $this->getServiceLocator()->get('viewhelpermanager')->get('InlineScript')->appendFile('/js/home-charts.js');
     $this->objectManager = $this->getServiceLocator()->get('Doctrine\\ORM\\EntityManager');
     return parent::dispatch($request, $response);
 }
開發者ID:newmight2015,項目名稱:zf2-blockchain-browser,代碼行數:6,代碼來源:ChartController.php

示例9: dispatch

 /** {@inheritdoc} */
 public function dispatch(\Zend\Stdlib\RequestInterface $request, \Zend\Stdlib\ResponseInterface $response = null)
 {
     // Fetch group with given name for actions referring to a particular group
     $action = $this->getEvent()->getRouteMatch()->getParam('action');
     if ($action != 'index' and $action != 'add') {
         try {
             $this->_currentGroup = $this->_groupManager->getGroup($request->getQuery('name'));
         } catch (\RuntimeException $e) {
             // Group does not exist - may happen when URL has become stale.
             $this->flashMessenger()->addErrorMessage('The requested group does not exist.');
             return $this->redirectToRoute('group', 'index');
         }
     }
     return parent::dispatch($request, $response);
 }
開發者ID:patrickpreuss,項目名稱:Braintacle,代碼行數:16,代碼來源:GroupController.php

示例10: dispatch

 /** {@inheritdoc} */
 public function dispatch(\Zend\Stdlib\RequestInterface $request, \Zend\Stdlib\ResponseInterface $response = null)
 {
     $this->setActiveMenu('Inventory', 'Network');
     return parent::dispatch($request, $response);
 }
開發者ID:patrickpreuss,項目名稱:Braintacle,代碼行數:6,代碼來源:NetworkController.php


注:本文中的Zend\Mvc\Controller\AbstractActionController::dispatch方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。