mitakeck/ulidtypes

UlidType plugin for CakePHP

Installs: 1 414

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 2

Forks: 1

Open Issues: 1

Type:cakephp-plugin

v0.0.2 2019-10-01 07:09 UTC

This package is auto-updated.

Last update: 2024-03-29 04:11:47 UTC


README

Setup

Install

$ composer require mitakeck/ulidtypes

Bootstrap

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

Model

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

        return $table;
    }
}
...