[TYPO3-dev] Possible RFC : Introducing ARRAY_LOOP cObject

Xavier Perseguers typo3 at perseguers.ch
Mon Jan 31 14:04:51 CET 2011


Hi Ingo,

> I'd simply call it LOOP and save the user from technical details (array)
> they may not know about or do not understand without a technical
> background.

Good point.

> Further, I'd make it support any kind of iterator so that it really
> supports any kind of data, not just arrays...

I tried to support Traversable but the problem is the object is 
processed too by tslib_content and at some stage ->data is used as an 
array and this crashes everything.

Best for those case is, as developer, to transform the iterator into an 
array using PHP built-in method:

class MyIterator implements Iterator {
	// stuff
}

pibase:

$this->cObj->start(iterator_to_array(new MyIterator(), TRUE));

and then it works as expected.

I started a bug tracker entry: http://bugs.typo3.org/view.php?id=17420. 
I suggest to further discuss this, having patch in BT and when we agree 
this is "ready", I'll post it to the core list. There is no point 
sending an RFC there which is not production-ready.

Xavier




More information about the TYPO3-dev mailing list