This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use the new forum.
Home » development » Documentation » INSERT INTO
INSERT INTO [message #79303] Tue, 02 June 2009 19:41 Go to next message
n.dempsey  is currently offline n.dempsey
Messages: 1
Registered: June 2009
Junior Member
I have an archive table that I would like to add the original data to before a save happens on an edit. I'm a total noob to php and symfony, what is my best way to do this?
Re: INSERT INTO [message #80076 is a reply to message #79303 ] Thu, 18 June 2009 00:54 Go to previous message
Russ  is currently offline Russ
Messages: 413
Registered: August 2008
Location: Oslo, Norway
Faithful Member

Sounds like the Doctrine versionable behaviour would be good for you, but if you are using a custom schema, just override the save() method of your class.

if ($this->isModified())
{
  $copy = new archiveTable;
  $copy->merge($this->toArray());
  $copy->save();

}

That will make a copy of the data you are saving... If you want to save the data before the object was edited, you'll have to do something slightly different - although in that case it's probably easier just to copy the row in the database... (maybe via a hook)


*On Freenode I am rooster*
http://www.walkandclimb.co.uk/images/monkeydust.jpghttp://www.walkandclimb.co.uk/userpix/2_linux_wave_small_2.jpg
Previous Topic:where to find documentation/usage guide of generate-module command?
Next Topic:link_to documentation confusion
Goto Forum:
  

powered by FUDforum - copyright ©2001-2004 FUD Forum Bulletin Board Software