‪TYPO3CMS  9.5
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 
18 
23 {
28  protected ‪$contentRepository;
29 
33  protected ‪$defaultViewObjectName = \TYPO3\CMS\Extbase\Mvc\View\JsonView::class;
34 
37  public function ‪indexAction()
38  {
39  $calls = [];
40  $calls[] = ['Content', 'list'];
41  $contents = $this->contentRepository->findAll();
42  foreach ($contents as $content) {
43  $uid = $content->getUid();
44  $calls[] = ['Content', 'show', ['content' => (string)$uid]];
45  }
46  $this->‪getQueueService()->set($calls);
47  $this->‪forward('process');
48  }
49 
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, $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 }
‪OliverHader\IrreTutorial\Controller
Definition: AbstractController.php:2
‪TYPO3\CMS\Extbase\Annotation
Definition: IgnoreValidation.php:4
‪OliverHader\IrreTutorial\Controller\QueueController\finishAction
‪finishAction()
Definition: QueueController.php:61
‪OliverHader\IrreTutorial\Controller\AbstractController\getPersistenceManager
‪TYPO3 CMS Extbase Persistence PersistenceManagerInterface getPersistenceManager()
Definition: AbstractController.php:109
‪OliverHader\IrreTutorial\Controller\AbstractController
Definition: AbstractController.php:23
‪TYPO3
‪OliverHader\IrreTutorial\Controller\AbstractController\getQueueService
‪OliverHader IrreTutorial Service QueueService getQueueService()
Definition: AbstractController.php:117
‪OliverHader\IrreTutorial\Controller\QueueController\$contentRepository
‪OliverHader IrreTutorial Domain Repository ContentRepository $contentRepository
Definition: QueueController.php:27
‪TYPO3\CMS\Extbase\Mvc\Cli\Request\getControllerObjectName
‪string getControllerObjectName()
Definition: Request.php:135
‪OliverHader\IrreTutorial\Controller\QueueController\$defaultViewObjectName
‪string $defaultViewObjectName
Definition: QueueController.php:31
‪OliverHader\IrreTutorial\Controller\QueueController\processAction
‪processAction()
Definition: QueueController.php:50
‪OliverHader\IrreTutorial\Controller\QueueController\indexAction
‪indexAction()
Definition: QueueController.php:35
‪OliverHader\IrreTutorial\Controller\QueueController\resolveController
‪TYPO3 CMS Extbase Mvc Controller ControllerInterface resolveController(\TYPO3\CMS\Extbase\Mvc\RequestInterface $request)
Definition: QueueController.php:76
‪TYPO3\CMS\Extbase\Mvc\Controller\ActionController\$request
‪TYPO3 CMS Extbase Mvc Request $request
Definition: ActionController.php:87
‪TYPO3\CMS\Extbase\Mvc\Controller\AbstractController\forward
‪forward($actionName, $controllerName=null, $extensionName=null, array $arguments=null)
Definition: AbstractController.php:247
‪OliverHader\IrreTutorial\Controller\QueueController
Definition: QueueController.php:23