Maybe this is what you want? $oSource = Doctrine::getTable('MyClass')->find(1); $oDest = Doctrine::getTable('MyClass')->find(2);
$oDest->fromArray($oSource->toArray(false)); // no deep copy required $oDest->save(); - Jon On Mon, Jun 29, 2009 at 12:39 PM, Jess OVR <jess...@gmail.com> wrote: > Hi all > > I'm quite new to Doctrine, but I've already made several project with > Propel. > > I would like to make a clone copy from a Doctrine object to another (both > existting in the db), so, reading the Doctrine doc, I tried : > > $oSource = Doctrine::getTable('MyClass')->find(1); > $oDest = Doctrine::getTable('MyClass')->find(2); > > $oDest = $oSource->copy(false); // no deep copy required > $oDest->save(); > > but this drives to an INSERT, where I'm expecting an UPDATE. > I thought save() method was smart enough to guess it's an UPDATE, and not > an INSERT (because $oDes obj is instantiated from db fetching, and not with > a new() call) ... > > How to copy all data exept the PK, and then update the object ? > > thank for any help :) > > ps : note this is a copy of my post : > http://forum.symfony-project.org/index.php/t/21565/ > > > > -- Jonathan H. Wage (+1 415 992 5468) Open Source Software Developer & Evangelist sensiolabs.com | jwage.com | doctrine-project.org | symfony-project.org You can contact Jonathan about Doctrine, Symfony and Open-Source or for training, consulting, application development, or business related questions at jonathan.w...@sensio.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~----------~----~----~----~------~----~------~--~---