Objects within Objects
Posted: Wed Nov 06, 2002 7:31 am
Hi all,
First off I'm a bit of a newbie with PHP so my terminology might be a bit off, but I've got some Lasso 6 experience.
OK my brickwall of a problem is:
I've got an instance of an object (M) which has a property in it that is an array, in this array a number of other instances of differing types of classes are stored. Each of these objects also has a property that is an array, which also stores more objects.... and so on, building up a hierarchy.
So how would I go about saying "OK, find me all the objects that are of type xyz and property abc is blue and put them in an array called Things" ?
The only way I can think of doing this is by using some form of recursion to go through each object and examine it's array, if it passes insert into Things.
Any advice in laymans terms of how I should go about this?
Hope this is clear.
Many thanks.
First off I'm a bit of a newbie with PHP so my terminology might be a bit off, but I've got some Lasso 6 experience.
OK my brickwall of a problem is:
I've got an instance of an object (M) which has a property in it that is an array, in this array a number of other instances of differing types of classes are stored. Each of these objects also has a property that is an array, which also stores more objects.... and so on, building up a hierarchy.
So how would I go about saying "OK, find me all the objects that are of type xyz and property abc is blue and put them in an array called Things" ?
The only way I can think of doing this is by using some form of recursion to go through each object and examine it's array, if it passes insert into Things.
Any advice in laymans terms of how I should go about this?
Hope this is clear.
Many thanks.