->insertRelation()
Inserts one or multiple relations in the database.
Method Syntax
$db->insertRelation($thing, $data)
Arguments
| Arguments | Type | Description |
|---|
thing required | string or Table
| Target table to insert the relation to. |
data optional | array
| An array of relations to insert. |
Example usage
$relation = $db->insertRelation('person', [
"id" => new RecordId('person', 'tobie'),
"in" => new RecordId('company', 'surreal'),
"out" => new RecordId('role', 'founder'),
]);
$relations = $db->insertRelation('person', [
[
"id" => new RecordId('person', 'tobie'),
"in" => new RecordId('company', 'surreal'),
"out" => new RecordId('role', 'founder'),
],
[
"id" => new RecordId('person', 'jaime'),
"in" => new RecordId('company', 'surreal'),
"out" => new RecordId('role', 'cofounder'),
],
]);