Hey guys.
I'm building an object collection which will be a part of a Data Access Layer i am currently working on. However, i am having some issues iterating through a collection.
This is what i've done so far
1 - Create 'user' class which maps to the MySQL table. The class has basic setters and getters to set/get each field value.
2 - Created a collection class with simple add/remove/get methods.
3 - Created user collection class which extends my collection class described above. This user collection class overwrites addItem() method to achieve adding item of type 'user' to my user collection.
4 - Created collection iterator class which implements Iterator interface and overwrites its basic methods such as rewind/next/current and etc.
5 - Changed my collection class to implement IteratorAggregate interface.
At this point i should be able to use foreach() operator on my collection object but i can't. In fact, it doesn't even go into the foreach loop.
Here is the source: dowload
you can see i was testing foreach in the user collection class.
I appreciate any help i can get on this.