We build a TYPO3 Flow model like this:
/* *
* This script belongs to the Flow package "DS.Datenbank". *
* *
* */
use TYPO3\Flow\Annotations as Flow;
use Some\Where\Domain\Model\User as USER;
use Doctrine\ORM\Mapping as ORM;
/**
* @Flow\Entity
*/
class Modelname {
/**
* The text content
* @var string
* @Flow\Validate(type="NotEmpty")
* @Flow\Validate(type="String")
*/
protected $content;
/**
* __construct
*
* @param $content the content
*/
public function __construct($content, $depth){
$this->content = $content;
}
/**
* getContent
*
* Returns the content
* @return $content
*/
public function getContent(){
return $this->content;
}
/**
* setContent
*
* Set a new content
* @param $content
* @return void
*/
public function setContent($content){
$this->content = $content;
}
}
?>
In most cases you use a public function addModelname(\Some\Where\Domain\Model\Modelname $modelname){...} in the ActionController. In this case we need it in another model. But we don't have the auto-validtion with the validatorResolver like in ActionControllers. Is there a simple way to pre-validate whole model objects with theire annotation validation?
I was talking about the
validatorResolverand did not read the documentation completely. The solution can be found at http://flowframework.readthedocs.io/en/stable/TheDefinitiveGuide/PartIII/Validation.html#validating-domain-modelsThe adapted example of my problem would be: