[TYPO3-mvc] RFC #8050: allow object properties to be optional (ie empty)

Pascal Jungblut mail at pascal-jungblut.com
Thu Jun 3 19:27:10 CEST 2010


Hey Martin,

> When a model has validators the value may never be empty.
> 
> Solution:
> 
> Honour the @optional annotation for a property.

I've had the same issue and suggested to allow chaining of validators with AND and OR. Well, Robert had a very easy solution for this [1]; Just make the argument optional:

public function setFooBar($foobar = NULL) {

That worked for me so far, meaning that properties only get validated if they contain something.

Regards
Pascal

[1] <http://lists.typo3.org/pipermail/typo3-project-5_0-general/2009-October/002437.html>


More information about the TYPO3-project-typo3v4mvc mailing list