add changes to account state

This commit is contained in:
2015-10-19 07:48:46 +02:00
parent b04cbda645
commit 9145f21371
50 changed files with 2139 additions and 27 deletions

View File

@@ -0,0 +1,49 @@
<?php
namespace common\components;
use yii\base\InvalidConfigException;
use Yii;
use yii\base\Model;
class ArrayValidator extends Validator
{
public $arrayAttributeName;
/**
* @inheritdoc
*/
public function init()
{
parent::init();
if ($this->message === null) {
$this->message = Yii::t('yii', '{attribute} is invalid.');
}
}
/**
* @inheritdoc
*/
public function validateAttribute($model, $attribute)
{
$value = $model->$attribute;
if (!is_array($value)) {
$this->addError($model, $attribute, $this->message);
return;
}
}
/**
* @inheritdoc
*/
protected function validateValue($value)
{
if (!is_array($value)) {
return [Yii::t('yii', '{attribute} is invalid.'), []];
}
return null;
}
}