1

I'm working Neo4j from PHP. To generate the uuid field in the nodes I am using: neo4j-uuid. I also use: graphaware/neo4j-php-ogm, when I create a node, I do not return the value assigned to the UUID field, I have to make a new query to get that value, I need to hydrate the UUID value automatically when the object is created, just like the ID is hydrated.

Jaime Roman
  • 749
  • 1
  • 11
  • 26

2 Answers2

0

From the GraphAware Neo4j UUID Github Repo:

If you create a node and return it immediately, its contents will not reflect changes performed by transaction event handlers such as this one -- thus the UUID will not be available. A separate call must be made to get the UUID.

That is: this is the expected behavior. Currently you should make a new query to get the node with the generated UUID property.

Bruno Peres
  • 15,845
  • 5
  • 53
  • 89
0

As it says @bruno-peres the value of the uuid is not automatically hydrated, so I invoke the refresh method of the EntityManager

$this->em->persist($entity);
$this->em->flush();
$this->em->refresh($entity);
var_dump($p->getUuid())
Jaime Roman
  • 749
  • 1
  • 11
  • 26