Re: Copying An EO Values
Re: Copying An EO Values
- Subject: Re: Copying An EO Values
- From: David Avendasora <email@hidden>
- Date: Mon, 4 Aug 2008 09:22:11 -0400
Gino,
I have implemented the solution outlined in Practical WO into my
project and I can say that it works phenomenally well. You have to
write a method for each Entity that describes _exactly_ what you want
to have happen when you ask for a copy, but once you do that it really
is as easy as calling that method and getting a copy back.
Dave
On Aug 3, 2008, at 7:50 PM, David LeBer wrote:
On 3-Aug-08, at 6:55 PM, Owen McKerrow wrote:
Hey,
Ondra's suggestion is the a good idea. Or you could have a look at
Chapter 9 of Chucks "Practical WebObjects" book, which is a whole
chapter on this very topic :)
And it requires an entire chapter because when you think about it,
it is NOT an insignificant thing to do:
- You may not want to clone all attributes for all entities
- You may not want to clone all relationships for all entities
- If cloning an object graph you may/will encounter circular
references that need to be dealt with.
Owen McKerrow
WebMaster, emlab
Ph : +61 02 4221 5517
http://emlab.uow.edu.au
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - -
'The test of a first-rate intelligence is the ability to hold two
opposed ideas in the mind at the same time and still be able to
function.'
-F.Scott Fitzgerald,
On 04/08/2008, at 5:52 AM, Gino Pacitti wrote:
Well what I mean is that instead of
neweo.setValue(existingeo.someValue());
for every value in the existingeo which I want to transpose to the
neweo.
Is there a operation like -
neweo = existineo.clone();
So all the values in the new eo are the same as existingeo but
obvioulsy with a new PK..
GIno
On 3 Aug 2008, at 20:41, Ondřej Čada wrote:
Gino,
On Aug 3, 2008, at 9:27 PM, Gino Pacitti wrote:
Has anyone had experience copying an EO values fetched and in
and EditingContext to a new EO in an atomic action?
"Atomic" in what sense?
Myself, I've always combined valuesForKeys and
takeValuesFromDictionary, but YMMV :)
;david
--
David LeBer
Codeferous Software
'co-def-er-ous' adj. Literally 'code-bearing'
site: http://codeferous.com
blog: http://davidleber.net
profile: http://www.linkedin.com/in/davidleber
twitter: http://twitter.com/rebeld
--
Toronto Area Cocoa / WebObjects developers group:
http://tacow.org
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden