Skip to content

Commit 54a5276

Browse files
committed
make api compatible with 5.3
1 parent 8904778 commit 54a5276

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

lib/triagens/ArangoDb/GraphHandler.php

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,8 @@ public function saveVertex($graph, $document ,$collection = null)
552552
if (count($this->getVertexCollections($graph)) !== 1 && $collection === null) {
553553
throw new ClientException('A collection must be provided.');
554554
} else if (count($this->getVertexCollections($graph)) === 1 && $collection === null) {
555-
$collection = $this->getVertexCollections($graph)[0];
555+
$collection = $this->getVertexCollections($graph);
556+
$collection = $collection[0];
556557
}
557558

558559
$data = $document->getAll();
@@ -608,7 +609,8 @@ public function getVertex($graph, $vertexId, array $options = array(), $collecti
608609
if (count($this->getVertexCollections($graph)) !== 1 && $collection === null) {
609610
throw new ClientException('A collection must be provided.');
610611
} else if (count($this->getVertexCollections($graph)) === 1 && $collection === null) {
611-
$collection = $this->getVertexCollections($graph)[0];
612+
$collection = $this->getVertexCollections($graph);
613+
$collection = $collection[0];
612614
}
613615

614616
$url = UrlHelper::buildUrl(Urls::URL_GRAPH, array($graph, Urls::URLPART_VERTEX, $collection, $vertexId));
@@ -662,7 +664,8 @@ public function replaceVertex($graph, $vertexId, Document $document, $options =
662664
if (count($this->getVertexCollections($graph)) !== 1 && $collection === null) {
663665
throw new ClientException('A collection must be provided.');
664666
} else if (count($this->getVertexCollections($graph)) === 1 && $collection === null) {
665-
$collection = $this->getVertexCollections($graph)[0];
667+
$collection = $this->getVertexCollections($graph);
668+
$collection = $collection[0];
666669
}
667670

668671
$options = array_merge(array(self::OPTION_REVISION => false), $options);
@@ -751,7 +754,8 @@ public function updateVertex($graph, $vertexId, Document $document, $options = a
751754
if (count($this->getVertexCollections($graph)) !== 1 && $collection === null) {
752755
throw new ClientException('A collection must be provided.');
753756
} else if (count($this->getVertexCollections($graph)) === 1 && $collection === null) {
754-
$collection = $this->getVertexCollections($graph)[0];
757+
$collection = $this->getVertexCollections($graph);
758+
$collection = $collection[0];
755759
}
756760

757761
$options = array_merge(array(self::OPTION_REVISION => false), $options);
@@ -825,7 +829,8 @@ public function removeVertex($graph, $vertexId, $revision = null, $options = arr
825829
if (count($this->getVertexCollections($graph)) !== 1 && $collection === null) {
826830
throw new ClientException('A collection must be provided.');
827831
} else if (count($this->getVertexCollections($graph)) === 1 && $collection === null) {
828-
$collection = $this->getVertexCollections($graph)[0];
832+
$collection = $this->getVertexCollections($graph);
833+
$collection = $collection[0];
829834
}
830835

831836
// This preserves compatibility for the old policy parameter.
@@ -883,7 +888,8 @@ public function saveEdge($graph, $from, $to, $label = null, $document, $collecti
883888
if (count($this->getEdgeCollections($graph)) !== 1 && $collection === null) {
884889
throw new ClientException('A collection must be provided.');
885890
} else if (count($this->getEdgeCollections($graph)) === 1 && $collection === null) {
886-
$collection = $this->getEdgeCollections($graph)[0];
891+
$collection = $this->getEdgeCollections($graph);
892+
$collection = $collection[0];
887893
}
888894

889895

@@ -949,7 +955,8 @@ public function getEdge($graph, $edgeId, array $options = array(), $collection =
949955
if (count($this->getEdgeCollections($graph)) !== 1 && $collection === null) {
950956
throw new ClientException('A collection must be provided.');
951957
} else if (count($this->getEdgeCollections($graph)) === 1 && $collection === null) {
952-
$collection = $this->getEdgeCollections($graph)[0];
958+
$collection = $this->getEdgeCollections($graph);
959+
$collection = $collection[0];
953960
}
954961

955962
$url = UrlHelper::buildUrl(Urls::URL_GRAPH, array($graph, Urls::URLPART_EDGE, $collection, $edgeId));
@@ -1004,7 +1011,8 @@ public function replaceEdge($graph, $edgeId, $label, Edge $document, $options =
10041011
if (count($this->getEdgeCollections($graph)) !== 1 && $collection === null) {
10051012
throw new ClientException('A collection must be provided.');
10061013
} else if (count($this->getEdgeCollections($graph)) === 1 && $collection === null) {
1007-
$collection = $this->getEdgeCollections($graph)[0];
1014+
$collection = $this->getEdgeCollections($graph);
1015+
$collection = $collection[0];
10081016
}
10091017

10101018
$options = array_merge(array(self::OPTION_REVISION => false), $options);
@@ -1097,7 +1105,8 @@ public function updateEdge($graph, $edgeId, $label, Edge $document, $options = a
10971105
if (count($this->getEdgeCollections($graph)) !== 1 && $collection === null) {
10981106
throw new ClientException('A collection must be provided.');
10991107
} else if (count($this->getEdgeCollections($graph)) === 1 && $collection === null) {
1100-
$collection = $this->getEdgeCollections($graph)[0];
1108+
$collection = $this->getEdgeCollections($graph);
1109+
$collection = $collection[0];
11011110
}
11021111

11031112
$options = array_merge(array(self::OPTION_REVISION => false), $options);
@@ -1177,7 +1186,8 @@ public function removeEdge($graph, $edgeId, $revision = null, $options = array()
11771186
if (count($this->getEdgeCollections($graph)) !== 1 && $collection === null) {
11781187
throw new ClientException('A collection must be provided.');
11791188
} else if (count($this->getEdgeCollections($graph)) === 1 && $collection === null) {
1180-
$collection = $this->getEdgeCollections($graph)[0];
1189+
$collection = $this->getEdgeCollections($graph);
1190+
$collection = $collection[0];
11811191
}
11821192

11831193
// This preserves compatibility for the old policy parameter.

0 commit comments

Comments
 (0)