Save object array to table with boolean result

bolean $database->path->to->class (array $objects [, integer $action=null]);

If you pass an array of same type objects to their class handler they will be inserted or updated individually. If any of them fails save process will not be interrupted but result will be false. If everyone succeeds than result will be true. If you want to force insert given array than pass second parameter also with value \db\query::insert.


$users = array ();
$users[] = new user ('John First');
$users[] = new user ('John Second');
$users[] = new user ('John Third');

if ($database->user->save($users))
    echo "all users saved";
    foreach ($users as $user)
        echo $user->name." new id is ".$user->id;
    echo "something went wrong while saving users";

For basic class handler save method behavior see Save single object to table.