PhpOrient icon indicating copy to clipboard operation
PhpOrient copied to clipboard

FetchPlan and PhpOrient\Protocols\Binary\Data\Bag

Open SpareShade opened this issue 9 years ago • 4 comments

Hi, thank you for providing this package.

I am having a difficulty understanding how to get fetched relationships from the returned record (PhpOrient\Protocols\Binary\Data\Record). They appear to be serialized in PhpOrient\Protocols\Binary\Data\Bag object.

any help would be much appreciated :) ...

SpareShade avatar Feb 10 '15 22:02 SpareShade

Hi, i think that this example can help you: Incorrect RID position, when fetched into Bag object

was a bug reported by @aurelijusb

Ostico avatar Feb 10 '15 23:02 Ostico

Hello, thank you for such a fast reply :) . I have had a look at all the issues/examples but I just can't figure it out.

This is what I have: Person (V) has out edge LivesAt(E) pointing to Address(V)

$callback = function( $record) { var_dump($record) }
$q = $PhpOrientClient->queryAsync(
     'select from Person limit 1',
     ['fetch_plan' =>  '*:-1', '_callback' => $callback]
);

when I var_dump($record) in the callback i get the fetched relationship(s) ie. LivesAt and the Address and if I var_dump($q) I get the Person ...

I just cannot figure out how to synthesize Person with its LivesAt edges ?? I've tried and tried but it just doesn't work ...

SpareShade avatar Feb 11 '15 01:02 SpareShade

Ah ok, i think you need something like this:

A graph example from @rochacbruno on pyorient

Ostico avatar Feb 11 '15 02:02 Ostico

Thanks for that, I had tried it but it seems to query the db anew for each expand.

SpareShade avatar Feb 11 '15 07:02 SpareShade