I'm using a SplObjectStorage to keep information about managed objects. When my objects get destructed, I would like the SplObjectStorage
to automatically cleanup the objects which have no external references anymore.
I can see only two options for this right now:
Any other ideas?
You can try to implement desired functionality with events. Each managed objects generates an event on destroy and the object manager is subscribed on this event so it will be able to remove a reference to object from the SplObjectStorage.