[TYPO3-mvc] How to delete a date entry

Xavier Perseguers xavier at typo3.org
Fri Mar 9 08:57:25 CET 2012


Hi,

> i guess you used typehinting in your setter Method. Right?
> Remove the typehinting in your setter.
> So you are not forced to define a DateTime Instance.

There's a trick I usually do for these cases:

public function setSomedate(DateTime $somedate = NULL) {

}

Having a default value to NULL is perfectly OK in addition to type hint
and you have "best" of two worlds.

HTH

-- 
Xavier Perseguers
Release Manager TYPO3 4.6

TYPO3 .... inspiring people to share!
Get involved: http://typo3.org



More information about the TYPO3-project-typo3v4mvc mailing list