[FLOW3-general] Put an entity to the Database with a DateTime property

Sebastian Kurfürst sebastian at typo3.org
Tue Aug 9 12:19:38 CEST 2011


Hey Patrick,

> /**
>   * @param \DateTime $timestamp
>   * @return void
>   */
> public function setTimestamp($timestamp) {
You should use a type hint inside the setter:

public function setTimestamp(\DateTime $timestamp) {

> Controller
> $post->setTimestamp("1990-01-01");
And that's actually the error: You need to pass a DateTime *Object* and
not a string. With the above change you would have noticed this a lot
earlier :)

Greets,
Sebastian


More information about the FLOW3-general mailing list