In that scenario, what I would do is something like:
addresses = createObject("component","AddressIBO").init();
addresses.loadQuery(query);
user.set('addresses',addresses);
You've created an address object that now can be a property of the user
object ("composition" in OO speak)
Now you can do this:
a = user.get('addresses');
While (a.hasNext()) {
doSomethingToA(a);
}
BTW, I created a hasNext() method which is similar to isLast() but
checks whether iterator is GT than numRecords. It made more sense in
while loops.
I'm also planning on adding "add" and "remove" methods, but I haven't
needed them (yet) but now I'm off-topic ;-)
Anthony
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Aaron
Roberson
Sent: Wednesday, March 21, 2007 2:32 PM
To: [email protected]
Subject: Re: [CFCDEV] ORM: Generic Child Array in Parent Bean
Interesting...
Peter replied with a similar answer:
"For child objects, you'd create another IBO, loadquery into that and
then if you had a child called Addresses, you'd User.set("Addresses",
Addresses) to load the sub object."
What meant by "create another IBO?"
I think I am way off with the following scenario, so please let me know
what I am doing wrong:
I have two objects: User and Address which have UserService and
AddressService. User extends IBO and Address extends IBO. I use
loadStruct() to populate my User object. Now I need to do a filtered
query and get all addresses with a userid of the User object. To do
that, I use AddressService to get a query of filtered addresses and then
pass the query to the loadQuery() method of the User object.
That does not sound to me like what Peter is saying to do.
-Aaron
On 3/21/07, Anthony Israel-Davis <[EMAIL PROTECTED]> wrote:
>
> Actually, I'm doing the same migration and the IBO does have the
> capacity for child objects: another IBO! If your property is addresses
> you could set it to the Address IBO. Composition is built in. I'm
> still writing my model, but that's the theory I'm working on and I
> haven't found any problems yet.
>
> Anthony
You are subscribed to cfcdev. To unsubscribe, please follow the
instructions at http://www.cfczone.org/listserv.cfm
CFCDev is supported by:
Katapult Media, Inc.
We are cool code geeks looking for fun projects to rock!
www.katapultmedia.com
An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]
You are subscribed to cfcdev. To unsubscribe, please follow the instructions at
http://www.cfczone.org/listserv.cfm
CFCDev is supported by:
Katapult Media, Inc.
We are cool code geeks looking for fun projects to rock!
www.katapultmedia.com
An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]