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