|
Posted by Simon Dean on 10/22/52 11:34
Thing is though... what if you just want to list a series of Actors that
you have on file (this is totally fictiional - It could be Orders Order
OrderDetails OrderDetail Customers Customer etc...
eg, at work, we might have a Customer belonging to Customers as a
collection, but a Customer can belong to an Order too, and an Order
contains many OrderDetail classes which can be retrieved through
OrderDetails etc.. etc.. complicated to explain for me...
Any how, back to my original observation... yes, what if I just want to
show an "actor" listing and therefore, I just want to load a particular
selection criteria and loop through as I would with while($line =
mysql_fetch_array($result))) { } (hey, did I just remember some coding?)???
I can get the MySQL results, I can even get an array of the result and
that can be accessed by through the class... but the main program would
still need to know about the database design... Ideally, Im thinking, I
could be wrong, I'd want to load each Actor record into a set of vars
within the class to present back that the main program can then pick up
the ones it wants to display them... But that means I would need to
create lots of Actor objects... but I can't necessarily tell $this to
create an array of itself do I? Hence I think is the idea to create a
wrapper in essence, a collection of Actors that does have an Array of
Actor classes, so we can loop through those and present them back to the
main program...
does that make sense? i think I totally lost myself.
Cheers
Simon
armando padilla wrote:
> Hi Simon,
>
> I briefly reviewed the code you posted but i totally agree that this
> model is flawed. I think (in your example Actors/Actor) there should
> be a class called Film and each film will have an array (collection) of
> Actor objects as a member. This would remove the "Actors" class and
> just force the developer to create instances of each actor to place
> into the Film.
>
>
> let me know if i totally lost anyone..lol
>
> Armando Padilla
>
[Back to original message]
|