TYPO3 CMS  TYPO3_6-2
AbstractController.php
Go to the documentation of this file.
1 <?php
3 
21 
26  protected $dataMapFactory;
27 
33  public function processRequest(\TYPO3\CMS\Extbase\Mvc\RequestInterface $request, \TYPO3\CMS\Extbase\Mvc\ResponseInterface $response) {
34  try {
35  parent::processRequest($request, $response);
36  } catch (\TYPO3\CMS\Extbase\Property\Exception $exception) {
37  throw new \RuntimeException(
38  $this->getRuntimeIdentifier() . ': ' . $exception->getMessage() . ' (' . $exception->getCode() . ')'
39  );
40  }
41  }
42 
47  protected function getStructure($iterator) {
48  $structure = array();
49 
50  if (!$iterator instanceof \Iterator) {
51  $iterator = array($iterator);
52  }
53 
54  foreach ($iterator as $entity) {
55  $dataMap = $this->dataMapFactory->buildDataMap(get_class($entity));
56  $tableName = $dataMap->getTableName();
57  $identifier = $tableName . ':' . $entity->getUid();
59 
60  $structureItem = array();
61  foreach ($properties as $propertyName => $propertyValue) {
62  $columnMap = $dataMap->getColumnMap($propertyName);
63  if ($columnMap !== NULL) {
64  $propertyName = $columnMap->getColumnName();
65  }
66  if ($propertyValue instanceof \Iterator) {
67  $structureItem[$propertyName] = $this->getStructure($propertyValue);
68  } else {
69  $structureItem[$propertyName] = $propertyValue;
70  }
71  }
72  $structure[$identifier] = $structureItem;
73  }
74 
75  return $structure;
76  }
77 
81  protected function process($value) {
82  if ($this->getQueueService()->isActive()) {
83  $this->getQueueService()->addValue($this->getRuntimeIdentifier(), $value);
84  $this->forward('process', 'Queue');
85  }
86  $this->view->assign('value', $value);
87  }
88 
92  protected function getRuntimeIdentifier() {
93  $arguments = array();
94  foreach ($this->request->getArguments() as $argumentName => $argumentValue) {
95  $arguments[] = $argumentName . '=' . $argumentValue;
96  }
97  return $this->request->getControllerActionName() . '(' . implode(', ', $arguments) . ')';
98  }
99 
103  protected function getPersistenceManager() {
104  return $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\PersistenceManagerInterface');
105  }
106 
110  protected function getQueueService() {
111  return $this->objectManager->get('OliverHader\\IrreTutorial\\Service\\QueueService');
112  }
113 
114 }
forward($actionName, $controllerName=NULL, $extensionName=NULL, array $arguments=NULL)
processRequest(\TYPO3\CMS\Extbase\Mvc\RequestInterface $request, \TYPO3\CMS\Extbase\Mvc\ResponseInterface $response)