I have several objects of type Item. The items are ordered but their ordering can change, so to make this ordering easy, I don't want to give each item its own order
property. I think it might be best to have the List store each Item as it gets created into an array maybe, and the item's order gets decided that way. (first of all, any design issues with this approach?)
My question is how can I still get the order of an Item by contacting the item itself? Ideally I want to do something like this
$item = new Item();
$item->getOrder();
The item has to depend on the List to get its order, so how should it do it?
I'm not fully decided on storing Items in an array in the List. Any other structure that makes things easier is fine. I'm trying to do this in a good OOP way.