Yii 1.1: yii-autonumber

Auto Number Extension for Yii 1
3 followers

Auto Number Extension for Yii 1

Requirements

Yii 1.1

Installation

Download extension from here and extract to extensions/autonumber.

Usage

Prepare required table by execute yii migrate.

yii migrate --migrationPath=ext.autonumber

Once the extension is installed, simply modify your active record class:

public function behavior()
{
    return array(
        array(
            'class' => 'ext.autonumber.MdmAutonumberBehavior',
            'attribute' => 'sales_num', // required
            'group' => 'sales', // required, unique
            'value' => 'SA-'.date('Y-m-d').'?' , // format auto number. '?' will be replaced with generated number
            'digit' => 4 // optional, default to null. 
        ),
        ...
    );
}

Resources

Fork me on github

Total 1 comment

#17546 report it
Misbahul D Munir at 2014/06/30 11:21pm
Notice

Sorry this extension removed a moment from original source (github).

mdmunir.

Leave a comment

Please to leave your comment.

Create extension
Downloads
No downloadable files yet