|
IMHO I would do the following:
Assuming you have 2 tables, one for personal info such name and last name and the other for address info. The address info table would have to also have an address type column. For example, 1 stands for home, 2 for business, etc etc.
Now I would go ahead and create getAddress() function with an optional argument called addressType..
So that if the suer specifies john.getAddress(2), the function would return a biz address, while, john.getAddress would return the users home address.
I hope this helps.
Sean Scott
-----Original Message-----
I have Hal's book and was reading his article on macromedia, and also reading all the posts to this list. I am trying to cement in my mind oop and cfc's. Can someone give me an idea on the following.
Almost every page I have has some kind of db interaction. Using Hal's example of composition, a person has an address, I would like to understand how to best implement this using a cfc. But, I want to understand it from the point of a person having more than one address, a one-to-many relationship.
If I have a list of persons in a database, with 1 or more addresses linked via a separate table, how do I code this using a cfc (getting info on a person from the db given their id). Right now I would simply link the two using some type of sql join in a single cfc. But I am wondering if there is a better way calling a separate cfc (address.cfc) that would give me better encapsulation and such.
TIA,
---------------------
--------------------- |
- [CFCDev] Marlon Moyer
- [CFCDev] Larry E. Lowe, Jr.
- [CFCDev] David Mineer
- [CFCDev] Todd
- RE: [CFCDev] Brian LeRoux
- RE: [CFCDev] Samuel Neff
- Re: [CFCDev] Christian Cantrell
- RE: [CFCDev] Raymond Camden
- RE: [CFCDev] sean
- RE: [CFCDev] Adrian Lynch
- [CFCDev] Scott Keene
- [CFCDev] Brad Howerter
- Re: [CFCDev] OOP cfc and Database David Mineer
- RE: [CFCDev] OOP cfc and Database Hal Helms
- [CFCDev] tony
- RE: [CFCDev] Nathan Dintenfass
- RE: [CFCDev] tony
- RE: [CFCDev] Nathan Dintenfass
- [CFCDev] marburg
