Class mdm\autonumber\NextValueValidator
Inheritance | mdm\autonumber\NextValueValidator » yii\validators\Validator » yii\base\Component » yii\base\Object |
---|---|
Available since version | 1.0 |
Validator use to fill autonumber
Use to fill attribute with formatet autonumber.
Usage at $owner rules()
return [
[['sales_num'], 'mdm\autonumber\NextValueValidator', 'format'=>'SA.'.date('Ymd').'?'],
...
]
Public Properties
Property | Type | Description | Defined By |
---|---|---|---|
$attributes | array|string | Attributes to be validated by this validator. | yii\validators\Validator |
$behaviors | yii\base\Behavior[] | List of behaviors attached to this component | mdm\autonumber\NextValueValidator |
$builtInValidators | array | List of built-in validators (name => class or configuration) | yii\validators\Validator |
$digit | integer | Digit number of auto number | mdm\autonumber\NextValueValidator |
$enableClientValidation | boolean | Whether to enable client-side validation for this validator. | yii\validators\Validator |
$except | array|string | Scenarios that the validator should not be applied to. | yii\validators\Validator |
$format | mixed | The default value or a PHP callable that returns the default value which will be assigned to the attributes being validated if they are empty. | mdm\autonumber\NextValueValidator |
$group | mixed | mdm\autonumber\NextValueValidator | |
$isEmpty | callable | A PHP callable that replaces the default implementation of isEmpty(). | yii\validators\Validator |
$message | string | The user-defined error message. | yii\validators\Validator |
$on | array|string | Scenarios that the validator can be applied to. | yii\validators\Validator |
$skipOnEmpty | mdm\autonumber\NextValueValidator | ||
$skipOnError | boolean | Whether this validation rule should be skipped if the attribute being validated already has some validation error according to some previous rules. | yii\validators\Validator |
$throwIsStale | boolean | mdm\autonumber\NextValueValidator | |
$unique | boolean | mdm\autonumber\NextValueValidator | |
$when | callable | A PHP callable whose return value determines whether this validator should be applied. | yii\validators\Validator |
$whenClient | string | A JavaScript function name whose return value determines whether this validator should be applied on the client side. | yii\validators\Validator |
Public Methods
Method | Description | Defined By |
---|---|---|
__call() | Calls the named method which is not a class method. | yii\base\Component |
__clone() | This method is called after the object is created by cloning an existing one. | yii\base\Component |
__construct() | Constructor. | yii\base\Object |
__get() | Returns the value of a component property. | yii\base\Component |
__isset() | Checks if a property value is null. | yii\base\Component |
__set() | Sets the value of a component property. | yii\base\Component |
__unset() | Sets a component property to be null. | yii\base\Component |
addError() | Adds an error about the specified attribute to the model object. | yii\validators\Validator |
attachBehavior() | Attaches a behavior to this component. | yii\base\Component |
attachBehaviors() | Attaches a list of behaviors to the component. | yii\base\Component |
beforeSave() | Handle for yii\db\ActiveRecord::EVENT_BEFORE_INSERT and yii\db\ActiveRecord::EVENT_BEFORE_UPDATE | mdm\autonumber\NextValueValidator |
behaviors() | Returns a list of behaviors that this component should behave as. | yii\base\Component |
canGetProperty() | Returns a value indicating whether a property can be read. | yii\base\Component |
canSetProperty() | Returns a value indicating whether a property can be set. | yii\base\Component |
className() | Returns the fully qualified name of this class. | yii\base\Object |
clientValidateAttribute() | Returns the JavaScript needed for performing client-side validation. | yii\validators\Validator |
createValidator() | Creates a validator object. | yii\validators\Validator |
detachBehavior() | Detaches a behavior from the component. | yii\base\Component |
detachBehaviors() | Detaches all behaviors from the component. | yii\base\Component |
ensureBehaviors() | Makes sure that the behaviors declared in behaviors() are attached to this component. | yii\base\Component |
getBehavior() | Returns the named behavior object. | yii\base\Component |
getBehaviors() | Returns all behaviors attached to this component. | yii\base\Component |
hasEventHandlers() | Returns a value indicating whether there is any handler attached to the named event. | yii\base\Component |
hasMethod() | Returns a value indicating whether a method is defined. | yii\base\Component |
hasProperty() | Returns a value indicating whether a property is defined for this component. | yii\base\Component |
init() | Initializes the object. | yii\validators\Validator |
isActive() | Returns a value indicating whether the validator is active for the given scenario and attribute. | yii\validators\Validator |
isEmpty() | Checks if the given value is empty. | yii\validators\Validator |
nextValue() | Calculate next value | mdm\autonumber\NextValueValidator |
off() | Detaches an existing event handler from this component. | yii\base\Component |
on() | Attaches an event handler to an event. | yii\base\Component |
trigger() | Triggers an event. | yii\base\Component |
validate() | Validates a given value. | yii\validators\Validator |
validateAttribute() | Validates a single attribute. | mdm\autonumber\NextValueValidator |
validateAttributes() | Validates the specified object. | yii\validators\Validator |
Protected Methods
Method | Description | Defined By |
---|---|---|
validateValue() | Validates a value. | yii\validators\Validator |
Property Details
List of behaviors attached to this component
Digit number of auto number
The default value or a PHP callable that returns the default value which will be assigned to the attributes being validated if they are empty. The signature of the PHP callable should be as follows,
function foo($model, $attribute) {
// compute value
return $value;
}
Method Details
void beforeSave( $event ) | ||
$event | yii\base\ModelEvent |
Calculate next value
integer nextValue( $object, $attribute ) | ||
$object | yii\db\ActiveRecord | |
$attribute | string |
Validates a single attribute.
Child classes must implement this method to provide the actual validation logic.
void validateAttribute( $object, $attribute ) | ||
$object | yii\base\Model | The data object to be validated |
$attribute | string | The name of the attribute to be validated. |