|
Method getData_collection( $sName ) |
|
Written by Hidalgo Emmanuel
|
Description : This method turns over a collection belonging to an object. Parameter : $sName, string : Indicate the name of the field which will identify the collection Value of return : Turn over a collection of object if this one is present in the object (it can be empty, if no child is present). Turn over “NULL” if the collection were not found. The following example posts the name of the products one “user”: <?php //total instanciation include_once( 'phpsimpledb.class.php' ); Global $oBDD; $oBDD = new PHPSIMPLEDB(); //recovery of "user" $oUser = $oBDD->getObject( "users" ); $oUser->load( 21 ); //recovery of the collection of the products $oCol_produits = $oUser->getData_collection( "produits" ); //posting of the names of the products foreach( $oCol_produits->getObjects() as $oProd ){ print( "nom du produit : ".$oProd->getData_field( "name" )."<br/>" ); }
?>
|
|