Exemplo n.º 1
0
 /**
  * Forwards the request to another command and / or CommandController.
  *
  * Request is directly transferred to the other command / controller
  * without the need for a new request.
  *
  * @param string $commandName
  * @param string $controllerObjectName
  * @param array $arguments
  * @throws \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException
  * @return void
  */
 protected function forward($commandName, $controllerObjectName = NULL, array $arguments = array())
 {
     $this->request->setDispatched(FALSE);
     $this->request->setControllerCommandName($commandName);
     if ($controllerObjectName !== NULL) {
         $this->request->setControllerObjectName($controllerObjectName);
     }
     $this->request->setArguments($arguments);
     $this->arguments->removeAll();
     throw new \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException();
 }
Exemplo n.º 2
0
 /**
  * Forwards the request to another command and / or CommandController.
  *
  * Request is directly transferred to the other command / controller
  * without the need for a new request.
  *
  * @param string $commandName
  * @param string $controllerObjectName
  * @param array $arguments
  * @return void
  * @throws StopActionException
  */
 protected function forward($commandName, $controllerObjectName = null, array $arguments = [])
 {
     $this->request->setDispatched(false);
     $this->request->setControllerCommandName($commandName);
     if ($controllerObjectName !== null) {
         $this->request->setControllerObjectName($controllerObjectName);
     }
     $this->request->setArguments($arguments);
     $this->arguments->removeAll();
     throw new StopActionException('forward', 1476107661);
 }
Exemplo n.º 3
0
 /**
  * @test
  */
 public function setControllerObjectNameAndSetControllerCommandNameUnsetTheBuiltCommandObject()
 {
     $this->request->setControllerObjectName('Tx_Extbase_Command_CacheCommandController');
     $this->request->setControllerCommandName('flush');
     $this->request->getCommand();
     $this->request->setControllerObjectName('Tx_SomeExtension_Command_BeerCommandController');
     $this->request->setControllerCommandName('drink');
     $this->mockObjectManager->expects($this->once())->method('get')->with(\TYPO3\CMS\Extbase\Mvc\Cli\Command::class, 'Tx_SomeExtension_Command_BeerCommandController', 'drink');
     $this->request->getCommand();
 }
Exemplo n.º 4
0
 /**
  * Execute Task
  *
  * If errors occur during Task execution they are thrown as Exceptions which
  * must be caught manually if you manually execute Tasks through your code.
  *
  * @param \TYPO3\CMS\Extbase\Scheduler\Task $task the task to execute
  * @return void
  */
 public function execute(\TYPO3\CMS\Extbase\Scheduler\Task $task)
 {
     $commandIdentifier = $task->getCommandIdentifier();
     list($extensionKey, $controllerName, $commandName) = explode(':', $commandIdentifier);
     $extensionName = \TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase($extensionKey);
     $this->initialize(array('extensionName' => $extensionName));
     // execute command
     $command = $this->commandManager->getCommandByIdentifier($commandIdentifier);
     $this->request->setControllerObjectName($command->getControllerClassName());
     $this->request->setControllerCommandName($command->getControllerCommandName());
     $this->request->setArguments($task->getArguments());
     $this->dispatcher->dispatch($this->request, $this->response);
     $this->shutdown();
 }