symfony1 - Reuse a Doctrine_Record object to save multiple instances of a model -


I am working on a notification module in the Symphony application. I am running a Doctrine_Collection to create a notification for every user who has an active flag in his profile:

  // Notification $ notification = Prepare and define normal values ​​of new notifications (); $ Notification & gt; SetField1 ('...'); $ Notification & gt; SetField2 ('...'); ... // Post Notification for users (sfGuardUserTable :: getInstance () - & gt; findByNotifyNewOrder (as the real) $ user) {$ Notice-> SetUser ID ($ user- & gt; getId ()); $ Notification & gt; Save (); }   

The problem is that once I have saved the first information, then I can not reuse the object to store new records in the database. I received the $ notification-> Tried to do null and "" with setId () , but tried to update the object rather than a new saved one. / P>

Is there a way to reuse the $ notification object? I would like to do this because the reasoning of the notification areas is a bit complicated.

Do you see again?

  // Notification Notification = Prepare and define normal values ​​of new notifications (); $ Notification & gt; SetField1 ('...'); $ Notification & gt; SetField2 ('...'); ... // Post notification foreach for users (sfGuardUserTable :: getInstance () - & gt; findByNotifyNewOrder (true) $ user) $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ NewNotification - & gt; SetUserId ($ user- & gt; getId ()); $ NewNotification- & gt; Save (); }    

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -