protected function validateUniqueness()
    {
        if (!$this->uniqueness)
            return true;
        $groupList = explode(";", $this->uniqueness);
        foreach ($groupList as $group) {
            $searchRule = "";
            $needCheck = true;
            $fields = explode(",", $group);
            foreach ($fields as $fld) {
                $bizField = $this->bizRecord->get($fld);
                if ($bizField->value === null || $bizField->value === "" || $bizField->value == $bizField->oldValue) {
                    $needCheck = false;
                    break;
                }
                if ($searchRule == "") {
                    $searchRule = "[" . $bizField->objectName . "]='" . addslashes($bizField->value) . "'";
                } else {
                    $searchRule .= " AND [" . $bizField->objectName . "]='" . addslashes($bizField->value) . "'";
                }
            }
            if ($needCheck) {
                $recordList = $this->directFetch($searchRule, 1);
                if ($recordList->count() > 0) {
                    $this->errorMessage = $this->getMessage("DATA_NOT_UNIQUE", array($group));
                    foreach ($fields as $fld) {
                        $this->errorFields[$fld] = $this->errorMessage;
                    }
                }
            }
        }
        if (count($this->errorFields) > 0) {
            throw new Openbizx\Validation\Exception($this->errorFields);
            return false;
        }
        return true;
    }
protected function validateUniqueness()
    {
        if (!$this->uniqueness)
            return true;
        $groupList = explode(";", $this->uniqueness);
        foreach ($groupList as $group) {
            $searchRule = "";
            $needCheck = true;
            $fields = explode(",", $group);
            foreach ($fields as $fld) {
                $bizField = $this->bizRecord->get($fld);
                if ($bizField->value === null || $bizField->value === "" || $bizField->value == $bizField->oldValue) {
                    $needCheck = false;
                    break;
                }
                if ($searchRule == "") {
                    $searchRule = "[" . $bizField->objectName . "]='" . addslashes($bizField->value) . "'";
                } else {
                    $searchRule .= " AND [" . $bizField->objectName . "]='" . addslashes($bizField->value) . "'";
                }
            }
            if ($needCheck) {
                $recordList = $this->directFetch($searchRule, 1);
                if ($recordList->count() > 0) {
                    $this->errorMessage = $this->getMessage("DATA_NOT_UNIQUE", array($group));
                    foreach ($fields as $fld) {
                        $this->errorFields[$fld] = $this->errorMessage;
                    }
                }
            }
        }
        if (count($this->errorFields) > 0) {
            throw new Openbizx\Validation\Exception($this->errorFields);
            return false;
        }
        return true;
    }
protected function validateUniqueness ( ) { if ( ! $ this -> uniqueness ) return true ; $ groupList = explode ( ";" , $ this -> uniqueness ) ; foreach ( $ groupList as $ group ) { $ searchRule = "" ; $ needCheck = true ; $ fields = explode ( "," , $ group ) ; foreach ( $ fields as $ fld ) { $ bizField = $ this -> bizRecord -> get ( $ fld ) ; if ( $ bizField -> value === null || $ bizField -> value === "" || $ bizField -> value == $ bizField -> oldValue ) { $ needCheck = false ; break ; } if ( $ searchRule == "" ) { $ searchRule = "[" . $ bizField -> objectName . "]='" . addslashes ( $ bizField -> value ) . "'" ; } else { $ searchRule .= " AND [" . $ bizField -> objectName . "]='" . addslashes ( $ bizField -> value ) . "'" ; } } if ( $ needCheck ) { $ recordList = $ this -> directFetch ( $ searchRule , 1 ) ; if ( $ recordList -> count ( ) > 0 ) { $ this -> errorMessage = $ this -> getMessage ( "DATA_NOT_UNIQUE" , array ( $ group ) ) ; foreach ( $ fields as $ fld ) { $ this -> errorFields [ $ fld ] = $ this -> errorMessage ; } } } } if ( count ( $ this -> errorFields ) > 0 ) { throw new Openbizx \ Validation \ Exception ( $ this -> errorFields ) ; return false ; } return true ; }
Validate uniqueness
Uniqueness = "fld1,fld2;fld3,fld4;..."

@return boolean
Validate uniqueness Uniqueness = fld1 fld2 ; fld3 fld4 ; ...