Method moveOrderField( $sName, $iId, $sBy = «asc» )
Written by Hidalgo Emmanuel   

Description :

             Allows to assemble or descend a value from a field of the integer type
             in a object by respecting the order of the list.

Parameters :

             $sName, string : Indicate the name of the field which will be used for displacement
             $sId, integer : Indicate the identifier of the object
             $sBy (optional), string : Indicate the direction of displacement
             «asc», indicating an ascending sorting
             «desc», indicating a tri descendant
             By defect this parameter is equal to «asc»

Value of return :

             Return “true” if displacement it passed well.
             Return “false” if the collection does not contain a object or if the object were not found.


The following example changes the position to the bottom of a product of a bundle of commodities one “user” :

 

<?php 

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

//loading of “user”
$oUser $oBDD->getObject"users" );
$oUser->load( 1);

// loading of the products of the “users” for construction of the collection
$oProduits_col $oUser->getData_collection"produits" );

// displacement of the position of the product
$oProduits_col->moveOrderField"position"4"desc" );

// print a “products” with their position
foreach( $oProduits_col->getObjects() as $oProduit ){
    print( 
"id : ".$oProduit->getData_field"id" ).", nom : ".$oProduit->getData_field"name" ).
           ", position : ".$oProduit->getData_field"position" )."<br/>" );
}

// store the collection
$oProduits_col->save();
?>