I have an instance of SplObjectStorage that stores the objects of the elements that will be displayed in the container. I would like to be able to effectively add and remove objects from any random position in the store.
Example:
<?php $store = new SplObjectStorageWrapper; $obj1 = new Obj; $obj2 = new Obj; $obj3 = new Obj; $store->attach($obj1); $store->attach($obj2); $store->insertAtIndex($obj3, 1);
How can I apply the insertAtIndex method? Should I use LimitIterator to disconnect and reconnect children after a certain position? Using array-based object storage was much slower than an instance of SplObjectStorage .
Other methods that I would like to implement include removeAtIndex(integer) and indexOf(object)
source share