TYPO3 CMS  TYPO3_6-2
Dispatcher.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Extbase\Mvc;
3 
21 
25  protected $objectManager;
26 
31  protected $reflectionService;
32 
38 
42  protected $settings = array();
43 
49  public function __construct(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager) {
50  $this->objectManager = $objectManager;
51  }
52 
61  public function dispatch(\TYPO3\CMS\Extbase\Mvc\RequestInterface $request, \TYPO3\CMS\Extbase\Mvc\ResponseInterface $response) {
62  $dispatchLoopCount = 0;
63  while (!$request->isDispatched()) {
64  if ($dispatchLoopCount++ > 99) {
65  throw new \TYPO3\CMS\Extbase\Mvc\Exception\InfiniteLoopException('Could not ultimately dispatch the request after ' . $dispatchLoopCount . ' iterations. Most probably, a @ignorevalidation or @dontvalidate (old propertymapper) annotation is missing on re-displaying a form with validation errors.', 1217839467);
66  }
67  $controller = $this->resolveController($request);
68  try {
69  $controller->processRequest($request, $response);
70  } catch (\TYPO3\CMS\Extbase\Mvc\Exception\StopActionException $ignoredException) {
71  }
72  }
73  $this->emitAfterRequestDispatchSignal($request, $response);
74  }
75 
82  protected function emitAfterRequestDispatchSignal(\TYPO3\CMS\Extbase\Mvc\RequestInterface $request, \TYPO3\CMS\Extbase\Mvc\ResponseInterface $response) {
83  $this->signalSlotDispatcher->dispatch(__CLASS__, 'afterRequestDispatch', array($request, $response));
84  }
85 
94  protected function resolveController(\TYPO3\CMS\Extbase\Mvc\RequestInterface $request) {
95  $controllerObjectName = $request->getControllerObjectName();
96  $controller = $this->objectManager->get($controllerObjectName);
97  if (!$controller instanceof \TYPO3\CMS\Extbase\Mvc\Controller\ControllerInterface) {
98  throw new \TYPO3\CMS\Extbase\Mvc\Exception\InvalidControllerException('Invalid controller "' . $request->getControllerObjectName() . '". The controller must implement the TYPO3\\CMS\\Extbase\\Mvc\\Controller\\ControllerInterface.', 1202921619);
99  }
100  return $controller;
101  }
102 }
__construct(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager)
Definition: Dispatcher.php:49
resolveController(\TYPO3\CMS\Extbase\Mvc\RequestInterface $request)
Definition: Dispatcher.php:94
emitAfterRequestDispatchSignal(\TYPO3\CMS\Extbase\Mvc\RequestInterface $request, \TYPO3\CMS\Extbase\Mvc\ResponseInterface $response)
Definition: Dispatcher.php:82
dispatch(\TYPO3\CMS\Extbase\Mvc\RequestInterface $request, \TYPO3\CMS\Extbase\Mvc\ResponseInterface $response)
Definition: Dispatcher.php:61