30 extends Zend_Validate_Abstract
32 const NAME_EMPTY =
'databaseNameEmpty';
33 const RENAME =
'databaseRename';
34 const EXISTS =
'databaseExists';
39 protected $_messageTemplates = array(
40 self::NAME_EMPTY =>
"Database name can not be empty",
41 self::RENAME =>
'Cannot rename %value% database',
42 self::EXISTS =>
"Database with name %value% alteady exists"
56 $value = $schema->getName();
59 $this->_error(self::NAME_EMPTY);
62 if ($schema && $value !== $schema->getOriginName()) {
63 if ($schema->isExist()) {
64 $this->_error(self::RENAME, $schema->getOriginName());
66 } elseif ($schema->getAdapter()->hasDatabase($value)) {
67 $this->_error(self::EXISTS, $value);