‪TYPO3CMS  10.4
AbstractController.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 
26 
31 {
36  protected ‪$dataMapFactory;
37 
44  {
45  try {
46  parent::processRequest(‪$request, ‪$response);
47  } catch (‪Exception $exception) {
48  throw new \RuntimeException(
49  $this->‪getRuntimeIdentifier() . ': ' . $exception->getMessage() . ' (' . $exception->getCode() . ')',
50  1476049553
51  );
52  }
53  }
54 
59  protected function ‪getStructure($iterator)
60  {
61  $structure = [];
62 
63  if (!$iterator instanceof \Iterator) {
64  $iterator = [$iterator];
65  }
66 
67  foreach ($iterator as $entity) {
68  $dataMap = $this->dataMapFactory->buildDataMap(get_class($entity));
69  $tableName = $dataMap->getTableName();
70  $identifier = $tableName . ':' . $entity->getUid();
71  $properties = ‪ObjectAccess::getGettableProperties($entity);
72 
73  $structureItem = [];
74  foreach ($properties as $propertyName => $propertyValue) {
75  $columnMap = $dataMap->getColumnMap($propertyName);
76  if ($columnMap !== null) {
77  $propertyName = $columnMap->getColumnName();
78  }
79  if ($propertyValue instanceof \Iterator) {
80  $structureItem[$propertyName] = $this->‪getStructure($propertyValue);
81  } else {
82  $structureItem[$propertyName] = $propertyValue;
83  }
84  }
85  $structure[$identifier] = $structureItem;
86  }
87 
88  return $structure;
89  }
90 
94  protected function ‪process($value)
95  {
96  if ($this->‪getQueueService()->isActive()) {
97  $this->‪getQueueService()->‪addValue($this->‪getRuntimeIdentifier(), $value);
98  $this->‪forward('process', 'Queue');
99  }
100  $this->view->assign('value', $value);
101  }
102 
106  protected function ‪getRuntimeIdentifier()
107  {
108  ‪$arguments = [];
109  foreach ($this->request->getArguments() as $argumentName => $argumentValue) {
110  ‪$arguments[] = $argumentName . '=' . $argumentValue;
111  }
112  return $this->request->getControllerActionName() . '(' . implode(', ', ‪$arguments) . ')';
113  }
114 
118  protected function ‪getPersistenceManager()
119  {
120  return $this->objectManager->get(PersistenceManagerInterface::class);
121  }
122 
126  protected function ‪getQueueService()
127  {
128  return $this->objectManager->‪get(QueueService::class);
129  }
130 }
‪TYPO3\CMS\Extbase\Mvc\Controller\ActionController\forward
‪forward($actionName, $controllerName=null, $extensionName=null, array $arguments=null)
Definition: ActionController.php:815
‪TYPO3\CMS\Extbase\Property\Exception
Definition: DuplicateObjectException.php:18
‪OliverHader\IrreTutorial\Controller
Definition: AbstractController.php:16
‪OliverHader\IrreTutorial\Controller\AbstractController\process
‪process($value)
Definition: AbstractController.php:93
‪TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface
Definition: PersistenceManagerInterface.php:22
‪TYPO3\CMS\Extbase\Annotation
Definition: IgnoreValidation.php:18
‪TYPO3\CMS\Extbase\Mvc\Controller\ActionController\$arguments
‪TYPO3 CMS Extbase Mvc Controller Arguments $arguments
Definition: ActionController.php:141
‪OliverHader\IrreTutorial\Controller\AbstractController\getPersistenceManager
‪TYPO3 CMS Extbase Persistence PersistenceManagerInterface getPersistenceManager()
Definition: AbstractController.php:117
‪OliverHader\IrreTutorial\Controller\AbstractController
Definition: AbstractController.php:31
‪TYPO3\CMS\Extbase\Mvc\ResponseInterface
Definition: ResponseInterface.php:22
‪OliverHader\IrreTutorial\Service\QueueService
Definition: QueueService.php:24
‪OliverHader\IrreTutorial\Controller\AbstractController\$dataMapFactory
‪TYPO3 CMS Extbase Persistence Generic Mapper DataMapFactory $dataMapFactory
Definition: AbstractController.php:35
‪OliverHader\IrreTutorial\Controller\AbstractController\getQueueService
‪OliverHader IrreTutorial Service QueueService getQueueService()
Definition: AbstractController.php:125
‪OliverHader\IrreTutorial\Controller\AbstractController\getRuntimeIdentifier
‪string getRuntimeIdentifier()
Definition: AbstractController.php:105
‪TYPO3\CMS\Extbase\Reflection\ObjectAccess
Definition: ObjectAccess.php:38
‪TYPO3\CMS\Extbase\Mvc\Controller\ActionController\$response
‪TYPO3 CMS Extbase Mvc Response $response
Definition: ActionController.php:115
‪TYPO3\CMS\Extbase\Reflection\ObjectAccess\getGettableProperties
‪static array getGettableProperties(object $object)
Definition: ObjectAccess.php:356
‪OliverHader\IrreTutorial\Service\QueueService\addValue
‪addValue($identifier, $value)
Definition: QueueService.php:79
‪TYPO3\CMS\Extbase\Property\Exception
Definition: Exception.php:26
‪OliverHader\IrreTutorial\Controller\AbstractController\processRequest
‪processRequest(RequestInterface $request, ResponseInterface $response)
Definition: AbstractController.php:42
‪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
‪TYPO3\CMS\Extbase\Mvc\Controller\ActionController
Definition: ActionController.php:55
‪OliverHader\IrreTutorial\Controller\AbstractController\getStructure
‪array getStructure($iterator)
Definition: AbstractController.php:58
‪OliverHader\IrreTutorial\Service\QueueService\get
‪array get()
Definition: QueueService.php:49