Fair enough. :) For a little more context, I debated using Gedmo’s 
Timestampable but I’m dealing with a nasty legacy database where nothing is 
stored cleaning in date time columns.

-- 
Stan Lemon


From: Marco Pivetta <[email protected]>
Reply: Marco Pivetta <[email protected]>>
Date: September 22, 2014 at 7:18:17 PM
To: Stan Lemon <[email protected]>>
Cc: [email protected] <[email protected]>>
Subject:  Re: [doctrine-user] Related objects and event listeners  

On 23 September 2014 01:12, Stan Lemon <[email protected]> wrote:
Marco,
The constructor is bypassed because the entity is being deserialized from json 
string, so basically what I’m trying to do is take the json data - deserialize 
it and make sure that some defaults like the object creation time get set

Yep, but some public API will still be called for that.
 
before I store it in the database.

And that's where I wanted to focus: `prePersist` is "when I store it in the 
database", while, as you already say, the correct version is "before I store it 
in the database".

I suggest doing that during the un-serialization ;-)

Marco Pivetta

http://twitter.com/Ocramius     

http://ocramius.github.com/

-- 
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.

Reply via email to