Uuid data extension for SilverStripe
Easily add uuid to your DataObjects
Simply add the extension to your DataObject
MyDataObject: extensions: - LeKoala\Uuid\UuidExtension
UuidExtension::getByUuid(MyDataObject::class, $uuid) to retrieve the record by Uuid.
Since that's really ugly, you can also use the
HasUuid trait on your classes to return a properly type hinted class.
In your templates, use UuidSegment to ensure Uuid value is generated on the record. UuidSegment are base62 encoded in order to be shorter and more readable.
Since Uuid's are stored in binary format for performance reason, you need to call $myObject->dbObject('Uuid')->Nice() to get a readable value.
If you happen to upgrade from previous versions you might want to check this guide
- Postgres compat
Tested with 4.4 and up
LeKoala - email@example.com