Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

guid - globally unique identifier


Reply


2 Posts   397 Views

Avatar
Isidro

Community Member, 4 Posts

15 February 2013 at 5:23am

I'm working in a project that uses a mobile app with data that must be sinchronized with a database in SS (few dataobjects).

In my mobile app, data records use globally unique identifiers as Ids, so i need to define dataobjects in SS also with guids. Can we change SS dataobject behaviour to use guids instead of integers as ID fields? What's the best field type in SS to store guids?

Has anyone used this datafields that would like to share some experience?

Regards,
Rui Isidro

Avatar
Willr

Forum Moderator, 5513 Posts

16 February 2013 at 1:19pm

Replacing the primary ID in DataObject is likely to be very hard and messy in core. You're best to store the GUID as a new column and simply writing your queries to use that rather than ID field (you can populate the GUID using onBeforeWrite()).