示例#1
0
 /**
  * 获取“事件名”验证规则
  * @param mixed $value
  * @return array
  */
 public function getAmcaNameRule($value)
 {
     if ($this->isUpdate()) {
         if ($this->_object->getAmcaNameByAmcaId($this->id) === $value) {
             return array();
         }
     }
     return array('Alpha' => new validator\AlphaValidator($value, true, Lang::_('SRV_FILTER_USER_AMCAS_AMCA_NAME_ALPHA')), 'MinLength' => new validator\MinLengthValidator($value, 2, Lang::_('SRV_FILTER_USER_AMCAS_AMCA_NAME_MINLENGTH')), 'MaxLength' => new validator\MaxLengthValidator($value, 16, Lang::_('SRV_FILTER_USER_AMCAS_AMCA_NAME_MAXLENGTH')), 'DbExists2' => new validator\DbExists2Validator($value, false, Lang::_('SRV_FILTER_USER_AMCAS_AMCA_NAME_UNIQUE'), $this->getDbProxy(), TableNames::getAmcas(), 'amca_name', 'amca_pid', $this->amca_pid));
 }
示例#2
0
文件: Amcas.php 项目: suyuanen/trotri
 /**
  * 通过主键,删除一条记录
  * @param integer $amcaId
  * @return integer
  */
 public function removeByPk($amcaId)
 {
     if (($amcaId = (int) $amcaId) <= 0) {
         return false;
     }
     $tableName = $this->getTblprefix() . TableNames::getAmcas();
     $sql = $this->getCommandBuilder()->createDelete($tableName, '`amca_id` = ? OR `amca_pid` = ?');
     $rowCount = $this->delete($sql, array($amcaId, $amcaId));
     return $rowCount;
 }