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.
Asked
Active
Viewed 214 times
2 Answers
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
-
Through php metadata, is there any way to specify that the uuid field be treated as an ID? – Jaime Roman May 04 '18 at 17:31
-
Hi @JaimeRoman.Thanks for accepting my answer. Unfortunately I'm not a PHP developer. So I cannot help you with this subject. Sorry. Maybe you should make a new question about it. – Bruno Peres May 04 '18 at 17:32
-
Thank you very much for your help @bruno-peres – Jaime Roman May 04 '18 at 17:34
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