Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to replace typo3 deprecated Annotation @validate Boolean(is=true)?

I have to upgrade a Typo3 v9 project to Typo3 v10.

Annotations like they were before are deprecated. I know how to replace something like @validate NotEmpty with @TYPO3\CMS\Extbase\Annotation\Validate("NotEmpty")

But I have some classes that use @validate Boolean(is=true)

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

As far as I can tell it means that the Checkbox of a form has to be checked and the validation is done in the model.

Can anyone please tell me how to replace this? Otherwise I think I have to code the validation in my controller class

>Solution :

You need to use options for this:

/**
 * @TYPO3\CMS\Extbase\Annotation\Validate("Boolean", options={"is": true})
 */
public bool $enabled;

See Validating in the domain model with annotations

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading