I have two copies of that book. I thought one at home and one in the office. I guess I have to wait till tomorrow at the office to read up.
thanks Ted --- On Sun, 3/20/11, David LeBer <[email protected]> wrote: > From: David LeBer <[email protected]> > Subject: Re: duplicating an EO > To: "Theodore Petrosky" <[email protected]> > Cc: [email protected] > Date: Sunday, March 20, 2011, 5:39 PM > > On 2011-03-20, at 4:59 PM, Theodore Petrosky wrote: > > > I have a rather simple object. it has about 15 > attributes. My users have informed me that they need a way > to insert 25 duplicates of this object. Obviously they go in > and change the due date (or some other attribute) of the > duplicates. this is the only change. > > > > so i gave them a simple popup with the numbers 1 to 25 > and they can choose how many of these things they want. > > > > what would be the easiest and bestest way to dup these > objects. I started thinking to create a loop that iterates > the number of times that they want and insert a new EO into > the EC and copy the attributes from my master object. > > > > But maybe there is an easier way? > > > > I hope I am explaining it simply enough > > > Practical WebObjects has a great chapter on EO copying. > > Unfortunately it is a subject that can eat an entire > chapter. Duplicating only the attributes is easy, you can > just ask the existing EO for it's entity, ask the entity for > it's attributes, and then iterate through them calling > setValueForKey on the new EO with valueForKey on the > existing one. However when you get into relationships things > become much more difficult to handle in a generic way (i.e: > do you want to copy the destination EOs or just the > relationships, do you want to copy the relationships of the > destination EOs, etc). > > Anyway, the chapter in Chuck's book is well worth the > read. > > ;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 protected]) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to [email protected]
