‪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;
21 use Symfony\Component\DependencyInjection\Attribute\Autoconfigure;
27 
31 #[Autoconfigure(public: true)]
33 {
39  protected ‪$forwardTargetAction;
40 
47 
48  public function ‪declareForwardTargetAction(string ‪$forwardTargetAction): void
49  {
50  $this->forwardTargetAction = ‪$forwardTargetAction;
51  }
52 
54  {
55  $this->forwardTargetArguments = ‪$forwardTargetArguments;
56  }
57 
58  protected function ‪addErrorFlashMessage(): void
59  {
60  // ignore flash messages
61  }
62 
63  public function ‪forwardAction(): ResponseInterface
64  {
65  return (new ‪ForwardResponse($this->forwardTargetAction))->withArguments($this->forwardTargetArguments);
66  }
67 
68  public function ‪inputPresetModelAction(‪Model $preset): ResponseInterface
69  {
70  $model = new ‪Model();
71  $model->setValue($preset->‪getValue());
72  $this->view->assignMultiple([
73  'model' => $model,
74  ]);
75  return $this->‪htmlResponse($this->view->render());
76  }
77 
78  public function ‪inputPresetDtoAction(‪ModelDto $preset): ResponseInterface
79  {
80  $dto = new ‪ModelDto();
81  $dto->setValue($preset->‪getValue());
82  $this->view->assignMultiple([
83  'dto' => $dto,
84  ]);
85  return $this->‪htmlResponse($this->view->render());
86  }
87 
91  public function ‪validateModelAction(Model $model): ResponseInterface
92  {
93  $this->view->assignMultiple([
94  'model' => $model,
95  ]);
96  return $this->‪htmlResponse($this->view->render());
97  }
98 
102  public function ‪validateDtoAction(ModelDto $dto): ResponseInterface
103  {
104  $this->view->assignMultiple([
105  'dto' => $dto,
106  ]);
107  return $this->‪htmlResponse($this->view->render());
108  }
109 }
‪TYPO3Tests\ActionControllerArgumentTest\Controller
Definition: ArgumentTestController.php:18
‪TYPO3Tests\ActionControllerArgumentTest\Controller\ArgumentTestController\$forwardTargetAction
‪string $forwardTargetAction
Definition: ArgumentTestController.php:38
‪TYPO3\CMS\Extbase\Annotation
Definition: IgnoreValidation.php:18
‪TYPO3Tests\ActionControllerArgumentTest\Controller\ArgumentTestController
Definition: ArgumentTestController.php:33
‪TYPO3Tests\ActionControllerArgumentTest\Domain\Model\ModelDto
Definition: ModelDto.php:24
‪TYPO3Tests\ActionControllerArgumentTest\Controller\ArgumentTestController\inputPresetModelAction
‪inputPresetModelAction(Model $preset)
Definition: ArgumentTestController.php:66
‪TYPO3\CMS\Extbase\Http\ForwardResponse
Definition: ForwardResponse.php:24
‪TYPO3\CMS\Extbase\Mvc\Controller\ActionController\htmlResponse
‪htmlResponse(?string $html=null)
Definition: ActionController.php:812
‪TYPO3Tests\ActionControllerArgumentTest\Domain\Model\ModelDto\getValue
‪getValue()
Definition: ModelDto.php:33
‪TYPO3Tests\ActionControllerArgumentTest\Controller\ArgumentTestController\$forwardTargetArguments
‪array $forwardTargetArguments
Definition: ArgumentTestController.php:44
‪TYPO3Tests\ActionControllerArgumentTest\Controller\ArgumentTestController\declareForwardTargetArguments
‪declareForwardTargetArguments(array $forwardTargetArguments)
Definition: ArgumentTestController.php:51
‪TYPO3Tests\ActionControllerArgumentTest\Controller\ArgumentTestController\validateModelAction
‪validateModelAction(Model $model)
Definition: ArgumentTestController.php:89
‪TYPO3Tests\ActionControllerArgumentTest\Controller\ArgumentTestController\addErrorFlashMessage
‪addErrorFlashMessage()
Definition: ArgumentTestController.php:56
‪TYPO3Tests\ActionControllerArgumentTest\Controller\ArgumentTestController\inputPresetDtoAction
‪inputPresetDtoAction(ModelDto $preset)
Definition: ArgumentTestController.php:76
‪TYPO3\CMS\Extbase\Mvc\Controller\ActionController
Definition: ActionController.php:63
‪TYPO3Tests\ActionControllerArgumentTest\Controller\ArgumentTestController\forwardAction
‪forwardAction()
Definition: ArgumentTestController.php:61
‪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:46
‪TYPO3Tests\ActionControllerArgumentTest\Controller\ArgumentTestController\validateDtoAction
‪validateDtoAction(ModelDto $dto)
Definition: ArgumentTestController.php:100