Esempio n. 1
0
	/**
	 * Finds and instanciates a controller that matches the current request.
	 * If no controller can be found, an instance of NotFoundControllerInterface is returned.
	 *
	 * @param \TYPO3\CMS\Extbase\Mvc\RequestInterface $request The request to dispatch
	 * @throws \TYPO3\CMS\Extbase\Mvc\Exception\InvalidControllerException
	 * @return \TYPO3\CMS\Extbase\Mvc\Controller\ControllerInterface
	 */
	protected function resolveController(\TYPO3\CMS\Extbase\Mvc\RequestInterface $request) {
		$controllerObjectName = $request->getControllerObjectName();
		$controller = $this->objectManager->get($controllerObjectName);
		if (!$controller instanceof \TYPO3\CMS\Extbase\Mvc\Controller\ControllerInterface) {
			throw new \TYPO3\CMS\Extbase\Mvc\Exception\InvalidControllerException('Invalid controller "' . $request->getControllerObjectName() . '". The controller must implement the TYPO3\\CMS\\Extbase\\Mvc\\Controller\\ControllerInterface.', 1202921619);
		}
		return $controller;
	}
Esempio n. 2
0
 /**
  * Maps arguments delivered by the request object to the local controller arguments.
  *
  * @throws Exception\RequiredArgumentMissingException
  * @return void
  */
 protected function mapRequestArgumentsToControllerArguments()
 {
     /** @var \TYPO3\CMS\Extbase\Mvc\Controller\Argument $argument */
     foreach ($this->arguments as $argument) {
         $argumentName = $argument->getName();
         if ($this->request->hasArgument($argumentName)) {
             $argument->setValue($this->request->getArgument($argumentName));
         } elseif ($argument->isRequired()) {
             throw new \TYPO3\CMS\Extbase\Mvc\Controller\Exception\RequiredArgumentMissingException('Required argument "' . $argumentName . '" is not set for ' . $this->request->getControllerObjectName() . '->' . $this->request->getControllerActionName() . '.', 1298012500);
         }
     }
 }