[TYPO3-mvc] Bug or feature: implementation of Iterator and ArrayAccess of Tx_Extbase_Persistence_ObjectStorage does't not work as expected

Marc Bastian Heinrichs typo3 at mbh-web.de
Fri Feb 18 11:02:32 CET 2011


Hey,

Am 18.02.11 10:45, schrieb Christian Zenker:

>> Is this a bug or feature?

Added an unit test to the issue:
http://forge.typo3.org/issues/13147


> It's more of a PHP bug/feature. Using current(), next(), etc. in  
> conjunction with unset() causes the issues you described. I guess the  
> objectStorage uses these methods internally.

Jep

> But the solution is usually not that simple if the objects are stored  
> internally in an associative array (which I guess they are, if I remind  
> correctly) as you are dependend on current() and next() in that case. So  
> you have to fiddle around a little.

Jep, the concept for implementing Iterator and ArrayAccess is not that
trivial. I already thought about having an $storageIndex, but then you
also need an mapping of the index to the storage keys. And then the
question is, how to make shure you have an complete iterable object when
you unset elements with the ArrayAccess method.

Best
Marc Bastian




More information about the TYPO3-project-typo3v4mvc mailing list