TYPO3 CMS  TYPO3_8-7
QueueController.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
21 {
26  protected $contentRepository;
27 
31  protected $defaultViewObjectName = \TYPO3\CMS\Extbase\Mvc\View\JsonView::class;
32 
35  public function indexAction()
36  {
37  $calls = [];
38  $calls[] = ['Content', 'list'];
39  $contents = $this->contentRepository->findAll();
40  foreach ($contents as $content) {
41  $uid = $content->getUid();
42  $calls[] = ['Content', 'show', ['content' => (string)$uid]];
43  }
44  $this->getQueueService()->set($calls);
45  $this->forward('process');
46  }
47 
50  public function processAction()
51  {
52  $call = $this->getQueueService()->shift();
53  if ($call === null) {
54  $this->forward('finish');
55  }
56  // Clear these states and fetch fresh entities!
57  $this->getPersistenceManager()->clearState();
58  $this->forward($call[1], $call[0], null, isset($call[2]) ? $call[2] : null);
59  }
60 
61  public function finishAction()
62  {
63  $this->request->setDispatched(true);
64  $value = $this->getQueueService()->getValues();
65  $this->view->assign('value', $value);
66  }
67 
76  protected function resolveController(\TYPO3\CMS\Extbase\Mvc\RequestInterface $request)
77  {
78  $controllerObjectName = $request->getControllerObjectName();
79  $controller = $this->objectManager->get($controllerObjectName);
80  if (!$controller instanceof \TYPO3\CMS\Extbase\Mvc\Controller\ControllerInterface) {
81  throw new \TYPO3\CMS\Extbase\Mvc\Exception\InvalidControllerException('Invalid controller "' . $request->getControllerObjectName() . '". The controller must implement the TYPO3\\CMS\\Extbase\\Mvc\\Controller\\ControllerInterface.', 1202921619);
82  }
83  return $controller;
84  }
85 }
resolveController(\TYPO3\CMS\Extbase\Mvc\RequestInterface $request)
forward($actionName, $controllerName=null, $extensionName=null, array $arguments=null)