Hi Stan, Just to be sure: why aren't you simply setting the `created` field to a `new DateTime` in `__construct()` instead?
Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/ On 22 September 2014 05:21, Stan Lemon <[email protected]> wrote: > Hello, > If I have a collection of related entities on an entity, which I go to > persist and I have an event listener with something like this: > > public function prePersist(LifecycleEventArgs $args) > { > $entity = $args->getObject(); > $entity->setCreated(new \DateTime()); > } > > I am getting an error when the persist cascades that the column mapped to > $created is null. > > Do I need to be doing something else to change the entity at this stage? > > Thanks for your help, > Stan > > -- > You received this message because you are subscribed to the Google Groups > "doctrine-user" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/doctrine-user. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "doctrine-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/doctrine-user. For more options, visit https://groups.google.com/d/optout.
