jadell / neo4jphp

PHP wrapper of the Neo4j REST interface
Other
533 stars 137 forks source link

Change relationship start/end nodes after creation? #133

Closed lrezek closed 10 years ago

lrezek commented 10 years ago

Hey, I'm writing an OGM based on your fantastic library, and I have a quick question about setStartNode(). For some reason, I cannot change the start node after a relationship save. I'd like to be able to do this:

//Initialize
$start = $client->makeNode()->save();
$end = $client->makeNode()->save();
$rel = $client->makeRelationship();
$rel->setStartNode($start)
->setEndNode($end)
->setType('something')
->save();

//Change start node
$new = $client->makeNode()->save();
$rel->setStartNode($new)->save();

Is such a thing possible? Thanks beforehand.

jadell commented 10 years ago

This is not possible in Neo4j. You can create create a new relationship and delete the old one, but you cannot change a relationship's type or start/end nodes once it is created.