/**
  * Maps arguments delivered by the request object to the local controller arguments.
  *
  * @throws Exception\RequiredArgumentMissingException
  * @return void
  */
 protected function mapRequestArgumentsToControllerArguments()
 {
     if ($this->configurationManager->isFeatureEnabled('rewrittenPropertyMapper')) {
         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);
             }
         }
     } else {
         // @deprecated since Extbase 1.4, will be removed two versions after Extbase 6.1
         $optionalPropertyNames = array();
         $allPropertyNames = $this->arguments->getArgumentNames();
         foreach ($allPropertyNames as $propertyName) {
             if ($this->arguments[$propertyName]->isRequired() === FALSE) {
                 $optionalPropertyNames[] = $propertyName;
             }
         }
         /** @var $validator ArgumentsValidator */
         $validator = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Controller\\ArgumentsValidator');
         $this->deprecatedPropertyMapper->mapAndValidate($allPropertyNames, $this->request->getArguments(), $this->arguments, $optionalPropertyNames, $validator);
         $this->argumentsMappingResults = $this->deprecatedPropertyMapper->getMappingResults();
     }
 }
Example #2
0
 /**
  * Prepares a view for the current action.
  * By default, this method tries to locate a view with a name matching the current action.
  *
  * @return ViewInterface
  * @api
  */
 protected function resolveView()
 {
     $viewObjectName = $this->resolveViewObjectName();
     if ($viewObjectName !== FALSE) {
         /** @var $view ViewInterface */
         $view = $this->objectManager->get($viewObjectName);
         $this->setViewConfiguration($view);
         if ($view->canRender($this->controllerContext) === FALSE) {
             unset($view);
         }
     }
     if (!isset($view) && $this->defaultViewObjectName != '') {
         /** @var $view ViewInterface */
         $view = $this->objectManager->get($this->defaultViewObjectName);
         $this->setViewConfiguration($view);
         if ($view->canRender($this->controllerContext) === FALSE) {
             unset($view);
         }
     }
     if (!isset($view)) {
         $view = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Mvc\\View\\NotFoundView');
         $view->assign('errorMessage', 'No template was found. View could not be resolved for action "' . $this->request->getControllerActionName() . '" in class "' . $this->request->getControllerObjectName() . '"');
     }
     $view->setControllerContext($this->controllerContext);
     if (method_exists($view, 'injectSettings')) {
         $view->injectSettings($this->settings);
     }
     $view->initializeView();
     // In FLOW3, solved through Object Lifecycle methods, we need to call it explicitely
     $view->assign('settings', $this->settings);
     // same with settings injection.
     return $view;
 }