0

I've just started with neo4j and NeoEloquent and I cannot get the edge (there is some important information) of a node which is related to himself.

Node referenced with himself

I add this relation like this:

UserMode.php

 public function getTech ()
    {
        return $this->belongsToMany(User::class, 'Conoce');
    }

When I try to get the edge like this:

dump(Auth::user()->getTech()->edge(Auth::user()->getTech[0]));

I get this error: Type error: Argument 1 passed to Vinelab\NeoEloquent\Eloquent\Edges\Finder::edgeFromRelationWithDirection() must be an instance of Everyman\Neo4j\Relationship, boolean given,

Thanks in advice!

1 Answers1

0

Your question isn't clear or complete enough to be sure of the right answer. Have you tried the following?

match (u1)-[:hasMany]->(u2) return u1,u2

This should return a result for the case where u1 and u2 are the same node and that node has a relationship to itself (if I remember correctly).

Otherwise, can you update your question to clarify more of the data model you're using and the Cypher you're trying to use?

Pat
  • 409
  • 4
  • 15
  • The correct cypher query whould be match (u1)-[relation:Conoce]->(u2) where ID(u1) =ID(u2) return u1,u2,relation But I want to get the edge witn NeoEloquent, I will update my question – Manuel Garcia Mar 21 '17 at 11:52
  • Sure - if you _only_ want the results where the nodes are identical; this wasn't clear from the original question. After your edit, I am not familiar with NeoEloquent, so I can't help you further. – Pat Mar 23 '17 at 09:26