[TYPO3-mvc] How to transform objects to array

Stefan Kruse besucher80 at gmx.de
Tue Jun 25 06:59:56 CEST 2013


> Your problem is not clear. You have objects, meaning you have an array
> of objects and the foreach loop works but you cannot access properties
> of your objects or the foreach loop itself does not work?

Hello Xavier,

maybe i missunderstood you. I try to better explain. I get a result
something like this:

object(Apache_Solr_Response)#999 (5) { 
	["_response":protected]=>
object(Apache_Solr_HttpTransport_Response)#1000 (5) { 
	
["_statusCode":"Apache_Solr_HttpTransport_Response":private]=> int(200) 
	
["_statusMessage":"Apache_Solr_HttpTransport_Response":private]=> string(2)
"OK" 
		["_mimeType":"Apache_Solr_HttpTransport_Response":private]=>
string(16) "application/json" 
		["_encoding":"Apache_Solr_HttpTransport_Response":private]=>
string(5) "UTF-8" 
	
["_responseBody":"Apache_Solr_HttpTransport_Response":private]=>
string(3917) "{"responseHeader":
	
{"status":0,"QTime":263,"params":{"facet":"true","facet.mincount":"1","start
":"0","q":"0","facet.field":"alpha_stringS","json.nl":"map","wt":"json","fq"
:"type:tx_tl24_domain_model_subcategory"}},"response":{"numFound":6,"start":
0,"docs":[{"id":"05870880cf3181b553ceb21d013807780e9b9d77/tx_tl24_domain_mod
el_subcategory

And so on. When i now overgive this result on a forech loop to iterate
through, I get the error message that the foreach only accepts arrays and
objects which implemented IteratorInterface. That's why I need to transform
my result to array. But maybe theres a better solution.

Thanks Stefan



More information about the TYPO3-project-typo3v4mvc mailing list