lekoala/silverstripe-uuid
最新稳定版本:2.0.0
Composer 安装命令:
composer require lekoala/silverstripe-uuid
包简介
Uuid data extension for SilverStripe
关键字:
README 文档
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.
Since that's really ugly, you can also use the HasUuid trait on your classes to return a properly type hinted class.
Usage in templates
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.
Getting readable values
Since Uuid's are stored in binary format for performance reason, you need to call $myObject->dbObject('Uuid')->Nice() to get a readable value.
Populate Uuids of existing DataObjects
Apply the PrepopulateUuidExtension to have Uuids for existing DataObjects generated on dev/build.
MyUuidDataObject: extensions: - LeKoala\Uuid\PrepopulateUuidExtension
Upgrade to Ramsey v4
If you happen to upgrade from previous versions you might want to check this guide
TODO
- Postgres compat
Worth reading
Storing UUID Values in MySQL GUID/UUID Performance Laravel: The mysterious “Ordered UUID”: offer a good overview of the situation although it's a bit laravel specific
Compatibility
Tested with SilverStripe 6 and up
For 4.x and 5.x, see branch 1
Maintainer
LeKoala - thomas@lekoala.be
统计信息
- 总下载量: 2.77k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-03-08