Vinelab / NeoEloquent

The Neo4j OGM for Laravel
MIT License
633 stars 199 forks source link

Dissociate() does not persist to Db #180

Closed KinaneD closed 4 years ago

KinaneD commented 7 years ago

Dissociate disconnects the related from the parent model but it does not persist to the db. This might sound logical since associate does the same (the relation should be saved). But in this case, the returned object is the parent model itself not the relationship, so when you call save(), it is actually saving the model again and NOT the relationship.

$relation = $parentModel->related()->dissociate();
$relation->save();

$relation is the parent model and not the relation.

ideepblue commented 6 years ago

I met this issue as well. One temporary solution is to delete the relationship from the EdgeOut side. Or delete the EdgeIn:

$relation = $parentModel->related()->edge();
$relation->delete();
stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.