/** * 获取“投票名”验证规则 * @param mixed $value * @return array */ public function getPollIdRule($value) { return array('DbExists' => new validator\DbExistsValidator($value, true, Lang::_('SRV_FILTER_POLLOPTIONS_POLL_ID_EXISTS'), $this->getDbProxy(), TableNames::getPolls(), 'poll_id')); }
/** * 获取“投票Key”验证规则 * @param mixed $value * @return array */ public function getPollKeyRule($value) { return array('AlphaNum' => new validator\AlphaNumValidator($value, true, Lang::_('SRV_FILTER_POLLS_POLL_KEY_ALPHANUM')), 'MinLength' => new validator\MinLengthValidator($value, 2, Lang::_('SRV_FILTER_POLLS_POLL_KEY_MINLENGTH')), 'MaxLength' => new validator\MaxLengthValidator($value, 20, Lang::_('SRV_FILTER_POLLS_POLL_KEY_MAXLENGTH')), 'DbExists' => new validator\DbExistsValidator($value, false, Lang::_('SRV_FILTER_POLLS_POLL_KEY_UNIQUE'), $this->getDbProxy(), TableNames::getPolls(), 'poll_key')); }
/** * 通过主键,删除一条记录 * @param integer $pollId * @return integer */ public function removeByPk($pollId) { if (($pollId = (int) $pollId) <= 0) { return false; } $tableName = $this->getTblprefix() . TableNames::getPolls(); $sql = $this->getCommandBuilder()->createDelete($tableName, '`poll_id` = ?'); $rowCount = $this->delete($sql, $pollId); return $rowCount; }