}
}
>
> Good luck. The book is key to understanding what the source
> code is doing. Implementing Chuck's EOCopyable functionality
> will probably take you marginally longer than just manually
> doing the duplicating _this time_ but once you set it up,
> it's available on all EOs and it is _very_ cool.
>
> I'm amazed that this hasn't made its way into WOnder yet...
> well maybe people still need a reason to buy Chuck's book. I
> mean, with all the other really excellent WO books out
> there...
>
> Oh wait...
>
> Dave
>
> On Mar 20, 2011, at 6:24 PM, Theodore Petrosky wrote:
>
> > 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@hidden>
> wrote:
> >
> >> From: David LeBer <
email@hidden>
> >> Subject: Re: duplicating an EO
> >> To: "Theodore Petrosky" <
email@hidden>
> >> Cc:
email@hidden
> >> 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
> >>
> >> --