Vinelab / NeoEloquent

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

Get edge cyclic reference #226

Closed mjgr0013 closed 4 years ago

mjgr0013 commented 7 years ago

Hi,

Suposing a User who rate himself, or another user, we have a belongsMany relationship, my User has this relationship: public function getRecommendedUsers () { return $this->belongsToMany(User::class, 'Conoce'); }

And I asign the relation like this: $user->getRecommendedUsers()->attach(Auth::user(), ["edge_atr_1" => "at1", "edge_att_2" => "at2])); This output me an EdgeIn relation at the time the relationship is created.

But after, when I try to get this Edge: Auth::user()->getRecommendedUsers()->edge() This returns a collection, due to belongsToMany, so when I pass a certain object in the edge like this: $user->getRecommendedUsers()->edge($user->getRecommendedUsers[0]) I get this error: FatalThrowableError in Finder.php line 173: Type error: Argument 1 passed to Vinelab\NeoEloquent\Eloquent\Edges\Finder::edgeFromRelationWithDirection() must be an instance of Everyman\Neo4j\Relationship, boolean given, called in /var/www/vendor/vinelab/neoeloquent/src/Vinelab/NeoEloquent/Eloquent/Edges/Finder.php on line 88

How can I get the edge who match a User with himself?

Thanks.

Mulkave commented 6 years ago

Can you please confirm this is still valid?

mjgr0013 commented 6 years ago

Hi,

Yes is still valid, if you need any extra information just ask for it.

Thanks.

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.