lekoala / silverstripe-uuid
Uuid data extension for SilverStripe
Fund package maintenance!
lekoala
Installs: 512
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:silverstripe-vendormodule
Requires
- php: >=7.2
- ramsey/uuid: ^3.9,<4
- silverstripe/framework: ^4
- silverstripe/versioned: ^1
- tuupola/base62: ^2.1
Requires (Dev)
- phpunit/phpunit: ^5.7
- squizlabs/php_codesniffer: ^3.0
README
Easily add uuid to your DataObjects
Getting started
Simply add the extension to your DataObject
MyDataObject:
extensions:
- LeKoala\Uuid\UuidExtension
Call UuidExtension::getByUuid(MyDataObject::class, $uuid) to retrieve the record by Uuid.
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.
Upgrade to Ramsey v4
If you happen to upgrade from previous versions you might want to check this guide
TODO
- Upgrade to Ramsey v4
- Postgres compat
Worth reading
Laravel: The mysterious “Ordered UUID”: offer a good overview of the situation although it's a bit laravel specific
Compatibility
Tested with 4.4 and up
Maintainer
LeKoala - thomas@lekoala.be