2017 © Pedro Peláez
 

cakephp-plugin stateful-enum

Simple stateful enum plugin for CakePHP 3

image

k1low/stateful-enum

Simple stateful enum plugin for CakePHP 3

  • Wednesday, April 6, 2016
  • by k1LoW
  • Repository
  • 1 Watchers
  • 1 Stars
  • 2,179 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 2 Versions
  • 1 % Grown

The README.md

Simple stateful enum plugin for CakePHP 3 Build Status

Installation

You can install this plugin into your CakePHP application using composer., (*1)

The recommended way to install composer packages is:, (*2)

composer require k1low/stateful-enum

Usage

class BugsTable extends Table
{
    const STATUS_UNASSIGNED = 'unassigned';
    const STATUS_ASSIGNED = 'assigned';
    const STATUS_RESOLVED = 'resolved';
    const STATUS_CLOSED = 'closed';

    public $transitions = [
        'status' => [
            'assign' => [
                'from' => self::STATUS_UNASSIGNED,
                'to' => self::STATUS_ASSIGNED
            ],
            'resolve' => [
                [self::STATUS_ASSIGNED, self::STATUS_UNASSIGNED], // from
                self::STATUS_RESOLVED // to
            ],
            'close' => [
                [self::STATUS_ASSIGNED, self::STATUS_UNASSIGNED, self::STATUS_RESOLVED],
                self::STATUS_CLOSED
            ],
        ]
    ];

    public function initialize(array $config)
    {
        $this->primaryKey('id');
        $this->addBehavior('StatefulEnum.StatefulEnum');
    }
}

So, This plugin set build state rules automatically., (*3)

References

This plugin is inspired by https://github.com/amatsuda/stateful_enum, (*4)

The Versions

06/04 2016

dev-master

9999999-dev https://github.com/k1low/stateful-enum

Simple stateful enum plugin for CakePHP 3

  Sources   Download

MIT

The Requires

 

The Development Requires

cakephp enum state

06/04 2016

v0.1.0

0.1.0.0 https://github.com/k1low/stateful-enum

Simple stateful enum plugin for CakePHP 3

  Sources   Download

MIT

The Requires

 

The Development Requires

cakephp enum state