‪TYPO3CMS  ‪main
ArgumentTestController.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
20 use Psr\Http\Message\ResponseInterface;
26 
31 {
37  protected ‪$forwardTargetAction;
38 
45 
46  public function ‪declareForwardTargetAction(string ‪$forwardTargetAction): void
47  {
48  $this->forwardTargetAction = ‪$forwardTargetAction;
49  }
50 
52  {
53  $this->forwardTargetArguments = ‪$forwardTargetArguments;
54  }
55 
56  protected function ‪addErrorFlashMessage(): void
57  {
58  // ignore flash messages
59  }
60 
61  public function ‪forwardAction(): ResponseInterface
62  {
63  return (new ‪ForwardResponse($this->forwardTargetAction))->withArguments($this->forwardTargetArguments);
64  }
65 
66  public function ‪inputPresetModelAction(‪Model $preset): ResponseInterface
67  {
68  $model = new ‪Model();
69  $model->setValue($preset->‪getValue());
70  $this->view->assignMultiple([
71  'model' => $model,
72  ]);
73  return $this->‪htmlResponse($this->view->render());
74  }
75 
76  public function ‪inputPresetDtoAction(‪ModelDto $preset): ResponseInterface
77  {
78  $dto = new ‪ModelDto();
79  $dto->setValue($preset->‪getValue());
80  $this->view->assignMultiple([
81  'dto' => $dto,
82  ]);
83  return $this->‪htmlResponse($this->view->render());
84  }
85 
89  public function ‪validateModelAction(Model $model): ResponseInterface
90  {
91  $this->view->assignMultiple([
92  'model' => $model,
93  ]);
94  return $this->‪htmlResponse($this->view->render());
95  }
96 
100  public function ‪validateDtoAction(ModelDto $dto): ResponseInterface
101  {
102  $this->view->assignMultiple([
103  'dto' => $dto,
104  ]);
105  return $this->‪htmlResponse($this->view->render());
106  }
107 }
‪TYPO3Tests\ActionControllerArgumentTest\Controller
Definition: ArgumentTestController.php:18
‪TYPO3Tests\ActionControllerArgumentTest\Controller\ArgumentTestController\$forwardTargetAction
‪string $forwardTargetAction
Definition: ArgumentTestController.php:36
‪TYPO3\CMS\Extbase\Annotation
Definition: IgnoreValidation.php:18
‪TYPO3Tests\ActionControllerArgumentTest\Controller\ArgumentTestController
Definition: ArgumentTestController.php:31
‪TYPO3Tests\ActionControllerArgumentTest\Domain\Model\ModelDto
Definition: ModelDto.php:24
‪TYPO3Tests\ActionControllerArgumentTest\Controller\ArgumentTestController\inputPresetModelAction
‪inputPresetModelAction(Model $preset)
Definition: ArgumentTestController.php:64
‪TYPO3\CMS\Extbase\Http\ForwardResponse
Definition: ForwardResponse.php:24
‪TYPO3Tests\ActionControllerArgumentTest\Domain\Model\ModelDto\getValue
‪getValue()
Definition: ModelDto.php:33
‪TYPO3Tests\ActionControllerArgumentTest\Controller\ArgumentTestController\$forwardTargetArguments
‪array $forwardTargetArguments
Definition: ArgumentTestController.php:42
‪TYPO3\CMS\Extbase\Mvc\Controller\ActionController\htmlResponse
‪htmlResponse(string $html=null)
Definition: ActionController.php:802
‪TYPO3Tests\ActionControllerArgumentTest\Controller\ArgumentTestController\declareForwardTargetArguments
‪declareForwardTargetArguments(array $forwardTargetArguments)
Definition: ArgumentTestController.php:49
‪TYPO3Tests\ActionControllerArgumentTest\Controller\ArgumentTestController\validateModelAction
‪validateModelAction(Model $model)
Definition: ArgumentTestController.php:87
‪TYPO3Tests\ActionControllerArgumentTest\Controller\ArgumentTestController\addErrorFlashMessage
‪addErrorFlashMessage()
Definition: ArgumentTestController.php:54
‪TYPO3Tests\ActionControllerArgumentTest\Controller\ArgumentTestController\inputPresetDtoAction
‪inputPresetDtoAction(ModelDto $preset)
Definition: ArgumentTestController.php:74
‪TYPO3\CMS\Extbase\Mvc\Controller\ActionController
Definition: ActionController.php:63
‪TYPO3Tests\ActionControllerArgumentTest\Controller\ArgumentTestController\forwardAction
‪forwardAction()
Definition: ArgumentTestController.php:59
‪TYPO3Tests\ActionControllerArgumentTest\Domain\Model\Model
Definition: Model.php:26
‪TYPO3Tests\ActionControllerArgumentTest\Domain\Model\Model\getValue
‪getValue()
Definition: Model.php:35
‪TYPO3Tests\ActionControllerArgumentTest\Controller\ArgumentTestController\declareForwardTargetAction
‪declareForwardTargetAction(string $forwardTargetAction)
Definition: ArgumentTestController.php:44
‪TYPO3Tests\ActionControllerArgumentTest\Controller\ArgumentTestController\validateDtoAction
‪validateDtoAction(ModelDto $dto)
Definition: ArgumentTestController.php:98