You can create dedicated class that is not a database model, but extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
and allows you to map the class by Extbase:
for an example file: typo3conf/ext/yourext/Classes/Domain/Form/SubscribeForm.php
<?php
namespace Vendor\Extname\Domain\Form;
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
class SubscribeForm extends AbstractEntity {
/**
* @var string
* @validate NotEmpty
*/
protected $name;
/**
* @var string
* @validate NotEmpty
* @validate EmailAddress
*/
protected $email;
/** @return string */
public function getName() {
return $this->name;
}
/** @param string $name */
public function setName($name) {
$this->name = $name;
}
/** @return string */
public function getEmail() {
return $this->email;
}
/** @param string $email */
public function setEmail($email) {
$this->email = $email;
}
}
With such class you can work as with common domain model and it will not be saved to anything - https://docs.typo3.org/typo3cms/ExtbaseFluidBook/9-CrosscuttingConcerns/2-validating-domain-objects.html
in your controller you will just handle it with two actions:
/**
* Displays the subscription form
*
* @param \Vendor\Extname\Domain\Form\SubscribeForm|NULL $subscribeForm
* @dontvalidate $subscribeForm
*/
public function subscribeAction(\Vendor\Extname\Domain\Form\SubscribeForm $subscribeForm = NULL) {
}
/**
* Handle the valid subscription form
*/
public function subscribeSaveAction(\Vendor\Extname\Domain\Form\SubscribeForm $subscribeForm) {
// Handle the $subscribeForm
}