RedBeanPHP

easy ORM for PHP

Legacy exportAll

Since 2.1: R::exportAll now accepts a second parameter $recursive. If this parameter is set to TRUE the exportAll function will return a recursive array with all beans (there is an infinite recursion check though), this is useful if you would like to load an entire bean hierarchy at once. This function is not very speedy though. You can use this function to return a complete XML or JSON representation of a bean hierarchy.


    $arrays 
R::exportAll$beanstrue );

Since 2.2.4 You can now add the maximum recursion level. Also you can indicate whether you want type-recursion, if switched off, the exporter will only export a certain type of bean once.


    $city 
R::dispense('city');
    
$people R::dispense('person',10);
    
$me reset($people);
    
$him end($people);
    
$city->sharedPeople $people;
    
$me->name 'me';
    
$suitcase R::dispense('suitcase');
    
$him->suitcase $suitcase;
    
$him->ownShoes R::dispense('shoe',2);
    
R::store($city);
    
$e = new RedBean_Plugin_BeanExport(R::$toolbox);
    
$e->loadSchema();
    
$data $e->exportLimited($me,false,4); //reaches the shoes and suitcase
    
$data $e->exportLimited($me,false,3); //does not reach the shoes and suitcase
    
$data $e->exportLimited($me,true,4); //does not reach the shoes and suitcase 
    //this last export does not reach  because he is of same type as $me
    


User contributed notes. Please use the comment section to provide tips, notes and examples. To ask for support or to provide feedback use the forum. For bug reports use Github Issue Tracker.

Site comments powered by Disqus

page generated in 0.0058188438415527 sec.