Пример #1
0
 /**
  * 通过主键,删除一条记录
  * @param integer $topicId
  * @return integer
  */
 public function removeByPk($topicId)
 {
     if (($topicId = (int) $topicId) <= 0) {
         return false;
     }
     $tableName = $this->getTblprefix() . TableNames::getTopic();
     $sql = $this->getCommandBuilder()->createDelete($tableName, '`topic_id` = ?');
     $rowCount = $this->delete($sql, $topicId);
     return $rowCount;
 }
Пример #2
0
 /**
  * 获取“专题Key”验证规则
  * @param mixed $value
  * @return array
  */
 public function getTopicKeyRule($value)
 {
     return array('AlphaNum' => new validator\AlphaNumValidator($value, true, Lang::_('SRV_FILTER_TOPIC_TOPIC_KEY_ALPHANUM')), 'MinLength' => new validator\MinLengthValidator($value, 2, Lang::_('SRV_FILTER_TOPIC_TOPIC_KEY_MINLENGTH')), 'MaxLength' => new validator\MaxLengthValidator($value, 20, Lang::_('SRV_FILTER_TOPIC_TOPIC_KEY_MAXLENGTH')), 'DbExists' => new validator\DbExistsValidator($value, false, Lang::_('SRV_FILTER_TOPIC_TOPIC_KEY_UNIQUE'), $this->getDbProxy(), TableNames::getTopic(), 'topic_key'));
 }