0 Replies Latest reply on Jun 7, 2011 7:43 AM by jjay@aus

    SaveEntity, pass in a form structure.

    jjay@aus

      I've just started playing with ORM, and one thing I learned pretty quickly is that I need to completely rework the way I think of my data and how I work with it, so forgive me if these questions seem odd.

       

      For years now, for each 'object', I have written my own methods.. one of these being save().  I can throw any structure at save() (e.g. a form) and it will work out how to handle it.

       

      So I can submit a form to something like ...  saveForm = myObject.save(argumentcollection=form);  If I pass in the identifier for the record, it will do an update based on that identifier, if there is no identifier it will insert a new record.

       

      I seem to be able create a new record with this appraoch using...  EntityNew('objName",formStruct) then EntitySave("objName") to create a new record, but does anyone know how I can upate an existing record using EntitySave() without having to pass each value into the setter for each property (e.g setName(form.name) ett....).

       

      If the struct I pass into EntityNew has an identifier it throws an error that a 'set' method for that property doesn't exist...

       

      So, to summarise.  Is there a way that I an update an existing record using ORM by just passing in a structure?

       

      Thanks in advance, and apologies if this is sounding like a madmans rambles..

       

      Jason