Vinelab / NeoEloquent

The Neo4j OGM for Laravel
MIT License
633 stars 199 forks source link

Neo4j | remove ID, replace UUID #181

Closed gburu98-zz closed 7 years ago

gburu98-zz commented 7 years ago

Good day, I have a question with Neo4j, as I can remove the ID property and replace UUID, can you help me? Thanks for your time!

ctorresr commented 7 years ago

What are you trying to accomplish?? neo4j ID property should never be removed.

KinaneD commented 7 years ago

@gburu98 Which version are you using? In general, you should be able to do so by setting in your model class the following properties:

protected $primaryKey = 'uuid';
protected $incrementing = false;        // as of Laravel 5.2
gburu98-zz commented 7 years ago

@ctorresr , I am using a generator UUID's, but it gives me error tells me that UUIDs are not supported, the problem is the length of perhaps uuid

gburu98-zz commented 7 years ago

@KinaneD , I am using laravel 5.3.11, I try to apply what you told me, and see if it works

gburu98-zz commented 7 years ago

look @KinaneD, probe and printed me a "fatal error" error

KinaneD commented 7 years ago

@gburu98 my bad, as the error says the incrementing property should be public not protected. What, where and when says that uuid are not supported? The error doesn't say so.

gburu98-zz commented 7 years ago

Thanks to "public $ incrementing = false;" no longer he tells me uuid is not supported, but I have a new error: nuevo

KinaneD commented 7 years ago

Sure! But this is a different topic. The uuid value is a string, when in the query displayed in the error the ' ' are missing so it is being treated differently.

gburu98-zz commented 7 years ago

Clear my fundamental problem was that I could not enter uuid I can now, I have to resize the string? as is done with Neo4j that amendment?

KinaneD commented 7 years ago

The string size is not relevant. Try casting to string whatever you assign to $u->uuid.

gburu98-zz commented 7 years ago

I am using a translator to read the English, it was unclear what the solution to the UUID is stored would be. that the last part is not stored? captura de pantalla de 2016-09-29 10-14-00

KinaneD commented 7 years ago

Try to cast to string $uuid = (string) Uuid::generate();.

gburu98-zz commented 7 years ago

Problem solved, thanks for your support @KinaneD !! bien