当前位置: 首页>>代码示例>>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;未经允许,请勿转载。