1 <?php
2 3 4 5 6 7 8
9
10 namespace frankmayer\ArangoDbPhpCore\Api\Rest;
11
12 use frankmayer\ArangoDbPhpCore\Protocols\Http\AbstractHttpRequest;
13
14
15 16 17 18 19
20 trait EdgeTrait
21 {
22 23 24 25 26 27 28 29 30 31
32 public function create(
33 $collection,
34 $from,
35 $to,
36 $body = null,
37 $urlQuery = [],
38 $options = []
39 ) {
40
41 $request = $this->getRequest();
42 $request->options = $options;
43 $request->body = $body;
44
45 if (is_array($request->body)) {
46 $request->body = json_encode($request->body);
47 }
48
49 $request->path = $this->client->fullDatabasePath . static::API_PATH;
50
51 $urlQuery = array_merge($urlQuery ? $urlQuery : [],
52 ['from' => $from, 'to' => $to],
53 ['collection' => $collection]);
54
55 $urlQuery = $request->buildUrlQuery($urlQuery);
56
57 $request->path .= $urlQuery;
58
59 $request->method = static::METHOD_POST;
60
61 return $this->getReturnObject($request);
62 }
63 }
64