TYPO3 CMS  TYPO3_7-6
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 
36  public function indexAction()
37  {
38  $calls = [];
39  $calls[] = ['Content', 'list'];
40  $contents = $this->contentRepository->findAll();
41  foreach ($contents as $content) {
42  $uid = $content->getUid();
43  $calls[] = ['Content', 'show', ['content' => (string)$uid]];
44  }
45  $this->getQueueService()->set($calls);
46  $this->forward('process');
47  }
48 
52  public function processAction()
53  {
54  $call = $this->getQueueService()->shift();
55  if ($call === null) {
56  $this->forward('finish');
57  }
58  // Clear these states and fetch fresh entities!
59  $this->getPersistenceManager()->clearState();
60  $this->forward($call[1], $call[0], null, isset($call[2]) ? $call[2] : null);
61  }
62 
63  public function finishAction()
64  {
65  $this->request->setDispatched(true);
66  $value = $this->getQueueService()->getValues();
67  $this->view->assign('value', $value);
68  }
69 
78  protected function resolveController(\TYPO3\CMS\Extbase\Mvc\RequestInterface $request)
79  {
80  $controllerObjectName = $request->getControllerObjectName();
81  $controller = $this->objectManager->get($controllerObjectName);
82  if (!$controller instanceof \TYPO3\CMS\Extbase\Mvc\Controller\ControllerInterface) {
83  throw new \TYPO3\CMS\Extbase\Mvc\Exception\InvalidControllerException('Invalid controller "' . $request->getControllerObjectName() . '". The controller must implement the TYPO3\\CMS\\Extbase\\Mvc\\Controller\\ControllerInterface.', 1202921619);
84  }
85  return $controller;
86  }
87 }
resolveController(\TYPO3\CMS\Extbase\Mvc\RequestInterface $request)
$uid
Definition: server.php:38
forward($actionName, $controllerName=null, $extensionName=null, array $arguments=null)