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

Patrick Sernetz patrickse at googlemail.com
Tue Aug 9 14:28:38 CEST 2011


Ok,

followed your advice and change my model and controller to that... and now
everything is working.. thanks for your help...

Patrick

Controller
    $post->setTimestamp(new \DateTime());
    $this->postRepository->add($post);

Model
    /**
     * @var \DateTime
     */
    protected $timestamp;

    /**
     * @param \DateTime $timestamp
     * @return void
     */
    public function setTimestamp(\DateTime $timestamp) {
        $this->timestamp = $timestamp;
    }

    /**
     * @return \DateTime
     */
    public function getTimestamp() {
        return $this->timestamp;
    }


More information about the FLOW3-general mailing list