示例#1
0
 /**
  * 获取“类型Key”验证规则
  * @param mixed $value
  * @return array
  */
 public function getTypeKeyRule($value)
 {
     return array('AlphaNum' => new validator\AlphaNumValidator($value, true, Lang::_('SRV_FILTER_MENU_TYPES_TYPE_KEY_ALPHANUM')), 'MinLength' => new validator\MinLengthValidator($value, 2, Lang::_('SRV_FILTER_MENU_TYPES_TYPE_KEY_MINLENGTH')), 'MaxLength' => new validator\MaxLengthValidator($value, 20, Lang::_('SRV_FILTER_MENU_TYPES_TYPE_KEY_MAXLENGTH')), 'DbExists' => new validator\DbExistsValidator($value, false, Lang::_('SRV_FILTER_MENU_TYPES_TYPE_KEY_UNIQUE'), $this->getDbProxy(), TableNames::getTypes(), 'type_key'));
 }
示例#2
0
文件: Types.php 项目: suyuanen/trotri
 /**
  * 通过主键,删除一条记录
  * @param integer $typeId
  * @return integer
  */
 public function removeByPk($typeId)
 {
     if (($typeId = (int) $typeId) <= 0) {
         return false;
     }
     $tableName = $this->getTblprefix() . TableNames::getTypes();
     $sql = $this->getCommandBuilder()->createDelete($tableName, '`type_id` = ?');
     $rowCount = $this->delete($sql, $typeId);
     return $rowCount;
 }
示例#3
0
 /**
  * 获取“类型Key”验证规则
  * @param mixed $value
  * @return array
  */
 public function getTypeKeyRule($value)
 {
     return array('DbExists' => new validator\DbExistsValidator($value, true, Lang::_('SRV_FILTER_MENUS_TYPE_KEY_EXISTS'), $this->getDbProxy(), TableNames::getTypes(), 'type_key'));
 }