Ostico / PhpOrient

PhpOrient - Official Php driver based on the binary protocol of OrientDB.
Other
68 stars 37 forks source link

Can't get part of a graph as JSON ? fetchplan ? #19

Closed kibarda closed 9 years ago

kibarda commented 9 years ago

I am exploring OrientDB & phpOrient. .

I am trying to get a user data (from OUser) with its related roles (from ORole ) as JSON from the GratefulDeadConcerts database.

In orientdb studio, I can write this request as: "select @this.toJSON('fetchPlan:*:-1') from #5:1" and I get the following result: {"name":"reader","password":"{SHA-256}...","status":"ACTIVE","roles":[{"name":"reader","inheritedRole":null,"mode":0,"rules":{"database.cluster.internal":2,"database.cluster.orole":2,"database":2,"database.function":2,"database.schema":2,"database.cluster.ouser":2,"database.command":2,"database.cluster":2,"database.hook.record":2,"database.class":2}}]}

Is is possible to extract the same data, as JSON with PHPOrient? I've tried all kinds of possibilities with queryAsync, recordLoad but could not get the correct result. In the best case I've got only the related #4:1 record from ORole ?

Is this a limitation of phpOrient or a bug or sth I misunderstood... ?

Thanks for any help !

kibarda commented 9 years ago

this seems to work : $q = $client->query( "select @this.toJSON('rid,fetchPlan:*:-1') from oUser");

Ostico commented 9 years ago

HI @kibarda ,

the web interface and the binary protocol have two different behaviours on that case. In the web interface the linkset are automatically expanded by OrientDB. In the binary protocol this is not done, so you have to perform more queries to obtain the additional data.