I've been searching the web a lot for clues but can't seem to find any...
public function createNew($name, $type, $restriction,$picture){
global $connection;
$trans=new Transaction($connection,array( 'collections' => array( 'write' => array( 'group_relations','groups' ),'read'=> array( 'group_relations','groups' ) ), 'waitForSync' => true ));
$trans->setAction('function(){
var db= require("@arangodb").db;
var arr=db.groups.insert({"name":"'.$name.'","type":"'.$type.'","restriction":"'.$restriction.'","picture":"'.$picture.'"}).toArray();
db.group_relations.insert({"_from":"users/'.$_SESSION['uid'].'","_to":"groups/"+arr[0]["_id"],"status":"admin"});
}');
$trans->execute();
}
this is a PHP function that makes a transaction. In the transaction, I'm trying to create a group, get its id and insert it in the relation collection between the creator and the new group.
Basically make the creator of the group the admin.
"Fatal error: Uncaught triagens\ArangoDb\ServerException: 17 db.groups.insert(...).toArray is not a function".
Any solutions?