Method addObject( $oObject )
Written by Hidalgo Emmanuel   

Description :

              The addition of a object allows a collection.
              If the collection belongs to a object (as “product” belongs to “users”),
              the added object will be automatically connected to the collection.

Parameter :

              $oObject, object : This parameter represents the object to be added

Value of return :

              Return “true” if the addition with the collection occurred well
              Return “false” if the object passed in parameter does not correspond to the type of the collection,
              or if the object does not contain an identifier.


The example following addition a product to the collection of the products of “users” :

 

<?php 

//total instanciation 
include_once( 'phpsimpledb.class.php' );
Global 
$oBDD;
$oBDD = new PHPSIMPLEDB();

// recover all the “products” one “to use”
$oUser $oBDD->getObject"users" );
$oUser->load) ;

// recover the collection of the products of “user”
$oProduits_col $oUser->getData_collection"produits" );

// creation of a new product
$oProduit $oBDD->getObject"produits" );
$oProduit->setData_field"name""Pavillon" );

// addition of the product to the collection of the products of “using”
$oProduits_col->addObject$oProduit ) ;
$oProduits_col->save();
?>