[TYPO3-mvc] How to delete a date entry
Ulrich Fischer
ulrich-fischer at gmx.net
Mon Jul 2 19:49:08 CEST 2012
Hi all,
Ulrich Fischer schrieb am 11.03.2012 16:55:
> A value of NULL is perfectly OK in addition to type hinting.
After Updating to typo3 4.7.1 there is a warning, that NULL is
not a DateTime object. So this workaround is obsolete.
My solution in the model class,
is creating a DateTimeObject with value 0:
public function __construct() {
// set 0 for unix Timestamp as DateTimeObject
$tmpDate = new DateTime();
$this->zeroDateTime = $tmpDate->setTimestamp(0);
}
and an additional method in the model object:
/**
* Removes the myDate value
* UnixTimestamp of $this->zeroDateTime = 0;
*/
public function removeDateMyDate() {
$this->myDate = $this->zeroDateTime;
}
Greetings from
Ulrich
--
http://www.sunfish.de
More information about the TYPO3-project-typo3v4mvc
mailing list