Example #1
0
 /**
  * 通过主键,删除一条记录
  * @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;
 }
Example #2
0
 /**
  * 获取“位置Key”验证规则
  * @param mixed $value
  * @return array
  */
 public function getTypeKeyRule($value)
 {
     return array('DbExists' => new validator\DbExistsValidator($value, true, Lang::_('SRV_FILTER_ADVERTS_TYPE_KEY_EXISTS'), $this->getDbProxy(), TableNames::getTypes(), 'type_key'));
 }
Example #3
0
 /**
  * 获取“位置Key”验证规则
  * @param mixed $value
  * @return array
  */
 public function getTypeKeyRule($value)
 {
     return array('AlphaNum' => new validator\AlphaNumValidator($value, true, Lang::_('SRV_FILTER_ADVERT_TYPES_TYPE_KEY_ALPHANUM')), 'MinLength' => new validator\MinLengthValidator($value, 2, Lang::_('SRV_FILTER_ADVERT_TYPES_TYPE_KEY_MINLENGTH')), 'MaxLength' => new validator\MaxLengthValidator($value, 20, Lang::_('SRV_FILTER_ADVERT_TYPES_TYPE_KEY_MAXLENGTH')), 'DbExists' => new validator\DbExistsValidator($value, false, Lang::_('SRV_FILTER_ADVERT_TYPES_TYPE_KEY_UNIQUE'), $this->getDbProxy(), TableNames::getTypes(), 'type_key'));
 }