Vinelab / NeoEloquent

The Neo4j OGM for Laravel
MIT License
634 stars 200 forks source link

Problem to use UUID's #176

Closed gburu98-zz closed 7 years ago

gburu98-zz commented 7 years ago

Good day, NeoEloquent team I want implemetar the UUID in my project, but I have an error with the integration in Neo4j, details:

1) laravel 5.2.31 2) https://github.com/webpatser/laravel-uuid

Use Uuid:generate(1), images...

Uuid version 1: uuid

Tinker: error

KinaneD commented 7 years ago

Good day @gburu98 , which version of NeoEloquent are you using? If you are using NeoEloquent 1.2.9 and up, you should not be facing any issues with primary keys. The problem is, that Neo4j uses an internal identifier to all its entities id, this id property cannot be tempered with. As per the Laravel documentation to costumize the primary key , the same applies to NeoEloquent, you should override id and specificy in your model that the primary key to be used is uuid, like so: protected $primaryKey = 'uuid';. You should also use $model->getKey() and $model->getKeyName() to access the primary key value and name respectively.

gburu98-zz commented 7 years ago

Thank you for responding, the solution does not work, try to manually send Neo4j browser and does not work, I guess is the size of the chain, there is a way to tell Neo4j uuid size?

NeoEloquent version: 1.3 *.