Commit b1409ccb authored by Shakarim Sapa's avatar Shakarim Sapa

- Correct the check to stop words rule

parent 2719bafd
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace common\modules\users\models; namespace common\modules\users\models;
use common\components\UnisenderAPI; use common\components\UnisenderAPI;
use common\modules\analyticsSchool\models\UserStopWords;
use common\modules\messageTemplate\controllers\TemplateAdminController; use common\modules\messageTemplate\controllers\TemplateAdminController;
use common\modules\messageTemplate\models\MessageTemplate; use common\modules\messageTemplate\models\MessageTemplate;
use common\modules\triggers\components\conditions\Conditions; use common\modules\triggers\components\conditions\Conditions;
...@@ -248,8 +249,11 @@ class User extends \common\components\ActiveRecordModel implements IdentityInter ...@@ -248,8 +249,11 @@ class User extends \common\components\ActiveRecordModel implements IdentityInter
* @return bool * @return bool
*/ */
public function checkToStopWord($attribute, $params) { public function checkToStopWord($attribute, $params) {
$this->addError($attribute, 'Name cant be a '.$this->$attribute); if (UserStopWords::find()->where(['word' => $this->$attribute, 'active' => 1])->exists()==true) {
return false; $this->addError($attribute, 'Имя не может принимать значение '.$this->$attribute);
return false;
}
return true;
} }
public function getEavAttributes() { public function getEavAttributes() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment