Building a collection of items from several structure fields?

How do I build a collection of items pertaining to several different structure fields?

For example, the following structure fields:

$restaurantes = $page->restaurantes()->toStructure();
$hoteles = $page->hoteles()->toStructure();
$transporte = $page->transporte()->toStructure();
$atracciones = $page->atracciones()->toStructure();

$allTogetherNow = ...

Specifically I’d like to be able to loop the resulting added structure object or collection without having to recursively enter each structure object within it.

In other words, I want a collection of items, not a collection of structure fields.

Is it possible ?

Thank you

Do these structure fields have the same structure? You could merge them just like you merge a page collection etc. but that would probably only make sense if they all have the same fields.

Yes they do, how would I merg them ? using add() ?

Add(), yes.

so:

$restaurantes = $page->restaurantes()->toStructure();
$hoteles = $page->hoteles()->toStructure();
$transporte = $page->transporte()->toStructure();
$atracciones = $page->atracciones()->toStructure();

$allTogetherNow = $restaurantes->merge($hoteles)->merge($transporte)->merge(atracciones)

Will that result in all the items of each structure field in a single structure object ?

Thank you

I edited my post above, merge only exists for pages, it seems.

But if you replace merge() with add() in your example above, that should actually work.

The result will be a single structure you can then loop through.