Closed liran89b closed 8 years ago
Thanks for the report, I'll check this and push a fix
@liran89b Can you provide the query you are executing ? I have created a test in the branch issue73
containing these assertions, until now I have no errors :
/**
* https://github.com/neoxygen/neo4j-neoclient/issues/73
*/
public function testReportedIssue()
{
$this->prepareDB();
$query1 = 'MATCH (n:Node {id:1}) OPTIONAL MATCH (n)-[r]->(o) RETURN n,r,o';
$result = $this->getConnection()->sendCypherQuery($query1)->getResult();
$this->assertInstanceOf(Node::class, $result->get('n', true));
$this->assertInstanceOf(Node::class, $result->get('o', true));
$this->assertInstanceOf(Relationship::class, $result->get('r', true));
$query2 = 'MATCH (n:Node {id:3}) OPTIONAL MATCH (n)-[r]->(o) RETURN n,r,o';
$result2 = $this->getConnection()->sendCypherQuery($query2)->getResult();
$this->assertInstanceOf(Node::class, $result2->get('n', true));
$this->assertEquals(null, $result2->get('r'));
}
Thanks for the replay. the query: MATCH (campaign:Campaign) - [created_for: CREATED_FOR]->(facebookPage:FacebookPage) , campaign- [happens_at: HAPPENS_AT]->(location:Location) WHERE facebookPage.id = '765315333518495' OPTIONAL MATCH (facebookAlbum:FacebookAlbum) -[opened_for:OPENED_FOR]- campaign RETURN created_for,happens_at,opened_for,campaign,facebookPage,location, collect (facebookAlbum) AS facebookAlbums LIMIT 25
because that the facebookAlbums return null its crash.
@liran89b Thanks, I have pushed a fix and released 3.3.13, please report if it fixes completely your use case.
Cheers! and Happy new year.
Im trying to return from the database nodes that some of them have the match and dome not. because is return null its crash on Result class here :
public function addRelationshipToIdentifier($relationshipId, $identifier) { if (isset($this->identifiers[$identifier])) { foreach ($this->identifiers[$identifier] as $rel) { if ($rel->getId() === $relationshipId) {
it can be fix by adding check if $rel is not null. i dont want to do that by myself (because future update) there is a way to fix it ? or update it in next version