Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getResult returns nothing #74

Closed
ivan83 opened this issue Jan 7, 2016 · 4 comments
Closed

getResult returns nothing #74

ivan83 opened this issue Jan 7, 2016 · 4 comments

Comments

@ivan83
Copy link

ivan83 commented Jan 7, 2016

Hi,

I am trying to run this piece of code (similar to a problem I have found here):

$query = "match (i:institutions)-[:worksAt]-(n:persons) WHERE toLower(i.name) CONTAINS toLower('moldova') return n";

$neo = $this->client->sendReadQuery($query);

$results = $this->client->getResult();
//tried this too:
//$results = $neo->getResult();


foreach ($results->getNodes() as $node)
{
    $nodes[] = [
        'name' => $node->getProperty('name'),
        'id' => $node->getId()
    ];
}

When I do print_r on $neo right after sendReadQuery, I can see the object, and the result of the query is there, just one row. Problem is, $results is emty, it is not an object.
I have tried getRows(), getTableFormat(), all sort of combinations, nothing works. getResponse returns me that same object with which none of the functions work.
All I want to do is get all the nodes out with their properties in some sort of array.

It must be something really simple I am missing out.

Thanks,
Ivan

@ivan83
Copy link
Author

ivan83 commented Jan 7, 2016

This is how printed out $neo object looks like if it helps.
neo.txt

@ikwattro
Copy link
Member

Hi,

Sorry for the delay.

It looks like you don't have the response formatting service enabled, can you give me the lines where you configure the client.

Or ideally check if you have

setAutoFormatResponse(true)

in the client build

@ivan83
Copy link
Author

ivan83 commented Jan 10, 2016

Hi,

Thanks for the reply. No, I do not. I did not know it was needed.

I turned to writing my own class that uses REST API directly as a temporary solution for now.
I will try this when I get some time.

@ikwattro
Copy link
Member

The Response formatting do the parsing of the rest api for you and hydrate the response to the result object with nodes and relationships.

In the meantime, please be aware that this Client has been recently acquired by GraphAware, the company I work for, there are no changes currently, you can still use Neoxygen\NeoClient but the next major release will happen at https://github.com/graphaware/neo4j-php-client.

The good thing is that, as we use Neo4j everyday, you can be certain of the client compatibility ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants