qumuinc/ulidtypes 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

qumuinc/ulidtypes

最新稳定版本:v0.0.5

Composer 安装命令:

composer require qumuinc/ulidtypes

包简介

UlidType plugin for CakePHP

README 文档

README

Setup

Install

$ composer require qumuinc/ulidtypes

Bootstrap

  • add plugin load command in config/bootstrap.php
...
Plugin::load('qumuinc/UlidTypes', ['bootstrap' => true]);
...

Model

  • add _initializeSchema() method to Model\Table class to make id ulid type
...
use Cake\Database\Schema\TableSchemaInterface;
...
class XXXXXXXXTable extends Table
{
    protected function _initializeSchema(TableSchemaInterface $table): TableSchemaInterface
    {
        parent::_initializeSchema($table);
        $table->setColumnType('id', 'ulid'); // set ulid type for id

        return $table;
    }
}
...

Or, you can use a trait.

...
use PrefixUlidType\PrefixUlidTypeTrait;
...
class XXXXXXXXTable extends Table
{
    use PrefixUlidTypeTrait;
}
...

If you want to use _initializeSchema function in your model, you need to call the _traitInitSchema function.

...
use Cake\Database\Schema\TableSchemaInterface;
use PrefixUlidType\PrefixUlidTypeTrait;
...
class XXXXXXXXTable extends Table
{
    use PrefixUlidTypeTrait;

    protected function _initializeSchema(TableSchemaInterface $table): TableSchemaInterface
    {
        parent::_traitInitSchema($table);
        $table->setColumnType('code', 'char'); // set any type for property

        return $table;
    }
}
...

统计信息

  • 总下载量: 1.44k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-10-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固