commit 8686e2cfc4a4ae8b0991af64fca2e75758fdd84d Author: Sasha Rybkin Date: Wed Nov 20 16:01:42 2024 +0300 init diff --git a/IntegerValidator.php b/IntegerValidator.php new file mode 100644 index 0000000..6c0319e --- /dev/null +++ b/IntegerValidator.php @@ -0,0 +1,25 @@ +message === null) { + $this->message = Yii::t('yii', '{attribute} must be an integer.'); + } + } + + public function validateAttribute($model, $attribute) + { + if (!is_int($model->$attribute)) { + $this->addError($model, $attribute, $this->message); + } + } +} diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..4caec13 --- /dev/null +++ b/composer.json @@ -0,0 +1,21 @@ +{ + "name": "dominion/validators", + "description": "Функционал для работы с validators", + "type": "yii2-extension", + "keywords": ["yii2","extension"], + "license": "MIT", + "authors": [ + { + "name": "Rybkin Sasha", + "email": "ribkin@dominion.ru" + } + ], + "require": { + "yiisoft/yii2": "~2.0.0" + }, + "autoload": { + "psr-4": { + "dominion\\validators\\": "" + } + } +} \ No newline at end of file