Open karvex opened 2 years ago
Hi @karvex \
\
I have maybe the same issue when I want to access a specific key in document like RETURN DOCUMENT('collection/_key').myKey
or FOR doc IN collection FILTER doc._key == '_key' RETURN doc.myKey
\
PHP launch NOTICE : \
Trying to access array offset on value of type int in .../vendor/triagens/arangodb/lib/ArangoDBClient/Document.php on line 304
\
I fix temporary the issue when I check $key is a string \
if (is_string($key) && $key[0] === '_') {
But I think is not enough to fix your issue
Apparently this is still broken a year later:
It seems to happen when the resultset is a generic array of other arrays or objects and not native documents.
I came up with a very similar fix to the one posted by @krkrTac.
@mtzonev :
The driver tries to turn the query result into an array of Document
objects by default. This will not work if the returned data aren't actually documents.
In this case, please try setting the _flat
option of the statement as follows:
$statement = new Statement($connection, ['_flat' => true]);
$statement->setQuery('RETURN (FOR i IN 1..1000 RETURN CONCAT("test", i))');
$cursor = $statement->execute();
It works with ArangoDB Queries UI, but not with triagens/arangodb v3.6.0.
I am using the following versions:
Anyone having the same problem and found a solution?