gabordemooij/redbean — Issue #105: ExportAll : depth limit / table loops
Author: Maigre
Created: 2011-11-09 12:00:12+00:00
State: open

Hi,
i'm now using the recursive mode for exportAll()
it works ok, but there is indeed speed issues when using it on heavy related tables.

I have 2 propositions to solve a part of this problem :

1. Could we imagine a depth limit for recursive export ?

May looks like :
$arrays = R::exportAll( $beans, true ); => full export as it works now
$arrays = R::exportAll( $beans, 3 ); => full export with a depth limit of 3

2. A way to avoid table looping in some cases
for example i have a table Person (id/name/city_id) related to a table City (id/name/ZIP)
in these case i would like to export a person with the city name :
$person['id']
$person['name']
$person['city']['id']
$person['city']['name']
$person['city']['ZIP']

but i don't want to export all other people related to these city :
for the moment the exportAll($beans,true) returns the person + the city + all other people from this city, etc...

=> That's why i thought that maybe a depth limit and/or a way to avoid table loop (Person->City but not Person again)
would be great !
But keeping the actual behaviour is also a good idea in certain cases

What do you think ?

Thanks for your work,
Best regards

Thomas