public function validate()
    {
        $report = parent::validate();

        $password = null;
        foreach ($this->formProperties as $key => $property) {
            if ($property['uri'] == GenerisRdf::PROPERTY_USER_PASSWORD && !empty($this->formProperties[$key]['formValue'])) {
                $password = $this->formProperties[$key]['formValue'];
                break;
            }
        }

        if ($this->isNew() || ($this->doesExist() && !is_null($password))) {
            try {
                $this->validatePassword($password);
                $this->changePassword = true;
            } catch (common_exception_ValidationFailed $e) {
                $subReport = common_report_Report::createFailure($e->getMessage());
                $subReport->setData(GenerisRdf::PROPERTY_USER_PASSWORD);
                $report->add($subReport);
            }
        }

        // Validate new login availability
        if ($this->isNew()) {
            foreach($this->formProperties as $property) {
                if ( $property['uri'] == 'http://www.tao.lu/Ontologies/generis.rdf#login') {
                    if ( empty($property['formValue']) ) {
                        $subReport = common_report_Report::createFailure(__('Login is empty.'));
                    } else if ( ! $this->isLoginAvailable($property['formValue']) ) {
                        $subReport = common_report_Report::createFailure(__('Login is already in use.'));
                    }

                    if ( isset($subReport) ) {
                        $subReport->setData($property['uri']);
                        $report->add($subReport);
                    }
                }
            }
        }

        return $report;
    }
public function validate()
    {
        $report = parent::validate();

        $password = null;
        foreach ($this->formProperties as $key => $property) {
            if ($property['uri'] == GenerisRdf::PROPERTY_USER_PASSWORD && !empty($this->formProperties[$key]['formValue'])) {
                $password = $this->formProperties[$key]['formValue'];
                break;
            }
        }

        if ($this->isNew() || ($this->doesExist() && !is_null($password))) {
            try {
                $this->validatePassword($password);
                $this->changePassword = true;
            } catch (common_exception_ValidationFailed $e) {
                $subReport = common_report_Report::createFailure($e->getMessage());
                $subReport->setData(GenerisRdf::PROPERTY_USER_PASSWORD);
                $report->add($subReport);
            }
        }

        // Validate new login availability
        if ($this->isNew()) {
            foreach($this->formProperties as $property) {
                if ( $property['uri'] == 'http://www.tao.lu/Ontologies/generis.rdf#login') {
                    if ( empty($property['formValue']) ) {
                        $subReport = common_report_Report::createFailure(__('Login is empty.'));
                    } else if ( ! $this->isLoginAvailable($property['formValue']) ) {
                        $subReport = common_report_Report::createFailure(__('Login is already in use.'));
                    }

                    if ( isset($subReport) ) {
                        $subReport->setData($property['uri']);
                        $report->add($subReport);
                    }
                }
            }
        }

        return $report;
    }
public function validate ( ) { $ report = parent :: validate ( ) ; $ password = null ; foreach ( $ this -> formProperties as $ key => $ property ) { if ( $ property [ 'uri' ] == GenerisRdf :: PROPERTY_USER_PASSWORD && ! empty ( $ this -> formProperties [ $ key ] [ 'formValue' ] ) ) { $ password = $ this -> formProperties [ $ key ] [ 'formValue' ] ; break ; } } if ( $ this -> isNew ( ) || ( $ this -> doesExist ( ) && ! is_null ( $ password ) ) ) { try { $ this -> validatePassword ( $ password ) ; $ this -> changePassword = true ; } catch ( common_exception_ValidationFailed $ e ) { $ subReport = common_report_Report :: createFailure ( $ e -> getMessage ( ) ) ; $ subReport -> setData ( GenerisRdf :: PROPERTY_USER_PASSWORD ) ; $ report -> add ( $ subReport ) ; } } // Validate new login availability if ( $ this -> isNew ( ) ) { foreach ( $ this -> formProperties as $ property ) { if ( $ property [ 'uri' ] == 'http://www.tao.lu/Ontologies/generis.rdf#login' ) { if ( empty ( $ property [ 'formValue' ] ) ) { $ subReport = common_report_Report :: createFailure ( __ ( 'Login is empty.' ) ) ; } else if ( ! $ this -> isLoginAvailable ( $ property [ 'formValue' ] ) ) { $ subReport = common_report_Report :: createFailure ( __ ( 'Login is already in use.' ) ) ; } if ( isset ( $ subReport ) ) { $ subReport -> setData ( $ property [ 'uri' ] ) ; $ report -> add ( $ subReport ) ; } } } } return $ report ; }
Validate the form against the property validators.
In case of range, check if value belong to associated ranges list

@return common_report_Report
Validate the form against the property validators . In case of range check if value belong to associated ranges list