Define your data model as an array, reach your data as an array.
For a complete example, please have a look at this folder.
For a more detailed documentation, please have a look at this folder.
For a sneak peek, follow the document.
foreach($adb->id_list('user') as $uid) {
$user=$adb->load('user', $uid);
echo 'User Name: ' . $user['name'] . "<br />\n";
foreach ($user['friend'] as $fid) {
$friend=$adb->load('user', $fid);
echo 'Friend Name: ' . $friend['name'] . "<br />\n";
}
echo "<br />\n";
}
$uid1=$adb->create('user', array('name'=>'Mustafa'));
$user1=$adb->load('user', $uid1);
$user1['name']='Mercan';
// no save needed, data saved automatically
$uid2=$adb->create('user', array('name'=>'Mustafa'));
$adb->relate('user', 'friend', $uid1, $uid2);
$adb->delete('user', $uid1);