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 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 Is there a way to reuse the Do you see again? 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 (); }
$ notification-> Tried to do
null and
"" with setId () , but tried to update the object rather than a new saved one. / P>
$ notification object? I would like to do this because the reasoning of the notification areas is a bit complicated.
// 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
Post a Comment