Affected feature:
Unable to use HasHandler on a graph with more then one vertex.
error: ArangoDBClient\\ClientException: A collection must be provided.
Steps to reproduce
create a graph with more than one vertex
call hasVertex on any vertex, get the error
Problem:
when calling GraphHandler method HasHandler, the signature is as described in the code:
/**
* Check if a vertex exists
*
* This will call self::getVertex() internally and checks if there
* was an exception thrown which represents an 404 request.
*
* @throws Exception When any other error than a 404 occurs
*
* @param mixed $graph - graph name as a string or instance of Graph
* @param mixed $vertexId - the vertex identifier
*
* @return boolean
*/
public function hasVertex($graph, $vertexId)
{
try {
// will throw ServerException if entry could not be retrieved
$this->getVertex($graph, $vertexId);
return true;
} catch (ServerException $e) {
// we are expecting a 404 to return boolean false
if ($e->getCode() === 404) {
return false;
}
// just rethrow
throw $e;
}
}
My graph has more then one vertex as described in the doc block of getVertex, so I need to pass the $collection parameter, but it does not exists in the hasVertex method
/**
* Get a single vertex from a graph
*
* This will throw if the vertex cannot be fetched from the server<br><br>
*
* @throws Exception
*
* @param mixed $graph - graph name as a string or instance of Graph
* @param mixed $vertexId - the vertex identifier
* @param array $options optional, an array of options:
* <p>
* <li><b>_includeInternals</b> - true to include the internal attributes. Defaults to false</li>
* <li><b>_ignoreHiddenAttributes</b> - true to show hidden attributes. Defaults to false</li>
* </p>
* @param string $collection - if one uses a graph with more than one vertex collection one must provide the collection
* to load the vertex.
*
* @return Document
* @since 1.2
*/
public function getVertex($graph, $vertexId, array $options = [], $collection = null)
Expected result:
hasVertex should work on a graph setup with more then one vertex
My Environment
Latest version (3.6.0), PHP 7.3
Component, Query & Data
Affected feature: Unable to use
HasHandler
on a graph with more then one vertex. error:ArangoDBClient\\ClientException: A collection must be provided.
Steps to reproduce
hasVertex
on any vertex, get the errorProblem: when calling
GraphHandler
methodHasHandler
, the signature is as described in the code:My graph has more then one vertex as described in the doc block of
getVertex
, so I need to pass the$collection
parameter, but it does not exists in thehasVertex
methodExpected result:
hasVertex
should work on a graph setup with more then one vertex