The-Don-Himself / gremlin-ogm

A PHP Object Graph Mapper for Tinkerpop 3+ compatible Graph Databases (JanusGraph, Neo4j, etc.) that allows you to persist data and run gremlin queries.
MIT License
17 stars 2 forks source link

Variables parameters in TraversalBuilder #6

Closed juhasev closed 6 years ago

juhasev commented 6 years ago

Trying to pass in simple variables into TraversalBuilder. By example:

$user_id = 10;

$command = $traversalBuilder
  ->g()
  ->V()
  ->hasLabel("'users'")
  ->has("'users_id'", "$user_id")
  ->getTraversal();

Should produce

g.V().hasLabel('users').has('users_id', 10)

But instead I get literal variable name in the query:

g.V().hasLabel('users').has('users_id', $user_id)

Not sure what is going on but digging deeper.

juhasev commented 6 years ago

Figured it out... Would help if you don't pass your variable enclosed single quotes :-)