/** * 通过主键,删除一条记录,禁止删除group_id=1,group_pid=0的根组 * @param integer $groupId * @return integer */ public function removeByPk($groupId) { if (($groupId = (int) $groupId) <= 1) { return false; } $tableName = $this->getTblprefix() . TableNames::getGroups(); $sql = $this->getCommandBuilder()->createDelete($tableName, '`group_id` = ?'); $rowCount = $this->delete($sql, $groupId); return $rowCount; }
/** * 获取“父ID”验证规则 * @param mixed $value * @return array */ public function getGroupPidRule($value) { return array('DbExists' => new validator\DbExistsValidator($value, true, Lang::_('SRV_FILTER_USER_GROUPS_GROUP_PID_EXISTS'), $this->getDbProxy(), TableNames::getGroups(), 'group_id')); }