sintonia/legacy/application/validate/UserNameValidate.php

26 lines
504 B
PHP
Raw Normal View History

2011-02-09 19:03:46 +01:00
<?php
class Application_Validate_UserNameValidate extends Zend_Validate_Abstract
{
2021-10-11 16:10:47 +02:00
public const LOGIN = 'login';
2021-10-11 16:10:47 +02:00
protected $_messageTemplates = [
self::LOGIN => "'%value%' is already taken",
];
2011-02-09 19:03:46 +01:00
public function isValid($value)
{
$this->_setValue($value);
2011-02-09 19:03:46 +01:00
$count = CcSubjsQuery::create()->filterByDbLogin($value)->count();
2011-02-09 19:03:46 +01:00
if ($count != 0) {
$this->_error(self::LOGIN);
2021-10-11 16:10:47 +02:00
2011-02-09 19:03:46 +01:00
return false;
}
2011-02-09 19:03:46 +01:00
return true;
}
}