Skip to content

Commit

Permalink
fix #4
Browse files Browse the repository at this point in the history
  • Loading branch information
mdmunir committed Oct 31, 2019
1 parent ab347e8 commit ec4f63b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
/nbproject/*
/nbproject/*
/vendor
/composer.lock
5 changes: 4 additions & 1 deletion AutoNumber.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace mdm\autonumber;

use Yii;
use yii\db\ActiveRecord;

/**
* This is the model class for table "auto_number".
*
Expand All @@ -12,7 +15,7 @@
* @author Misbahul D Munir <misbahuldmunir@gmail.com>
* @since 1.0
*/
class AutoNumber extends \yii\db\ActiveRecord
class AutoNumber extends ActiveRecord
{

/**
Expand Down
4 changes: 2 additions & 2 deletions AutonumberValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace mdm\autonumber;

use yii\db\ActiveRecord;
use yii\db\StaleObjectException;
use yii\validators\Validator;

/**
* Validator use to fill autonumber
Expand All @@ -22,7 +22,7 @@
* @author Misbahul D Munir <misbahuldmunir@gmail.com>
* @since 1.0
*/
class AutonumberValidator extends \yii\validators\Validator
class AutonumberValidator extends Validator
{
/**
* @var mixed the default value or a PHP callable that returns the default value which will
Expand Down
8 changes: 3 additions & 5 deletions Behavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

namespace mdm\autonumber;

use yii\db\StaleObjectException;
use yii\behaviors\AttributeBehavior;
use yii\db\BaseActiveRecord;
use Exception;

/**
* Behavior use to generate formated autonumber.
Expand All @@ -17,8 +16,7 @@
* ...
* [
* 'class' => 'mdm\autonumber\Behavior',
* 'value' => date('Ymd').'.?', // ? will replace with generated number
* 'digit' => 6, // specify this if you need leading zero for number
* 'value' => 'INV-{Ymd}-????', // ? will replace with generated number
* ]
* ]
* }
Expand All @@ -27,7 +25,7 @@
* @author Misbahul D Munir <misbahuldmunir@gmail.com>
* @since 1.0
*/
class Behavior extends \yii\behaviors\AttributeBehavior
class Behavior extends AttributeBehavior
{
/**
* @var integer digit number of auto number
Expand Down

0 comments on commit ec4f63b

Please sign in to comment.