本文整理汇总了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);
}
示例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);
}
示例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
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例10: dispatch
/** {@inheritdoc} */
public function dispatch(\Zend\Stdlib\RequestInterface $request, \Zend\Stdlib\ResponseInterface $response = null)
{
$this->setActiveMenu('Inventory', 'Network');
return parent::dispatch($request, $response);
}