protected function validate()
    {
        $errors = array();
        foreach ($this->requiredAttributes as $requiredAttribute) {
            if (!ArrayHelper::keyExists($this->data, $requiredAttribute)) {
                $errors[] = $requiredAttribute.' is missing or empty';
            }
        }

        if (count($errors) > 0) {
            throw new ValidationError(get_called_class().' object misses required fields', $errors);
        }

        return true;
    }
protected function validate()
    {
        $errors = array();
        foreach ($this->requiredAttributes as $requiredAttribute) {
            if (!ArrayHelper::keyExists($this->data, $requiredAttribute)) {
                $errors[] = $requiredAttribute.' is missing or empty';
            }
        }

        if (count($errors) > 0) {
            throw new ValidationError(get_called_class().' object misses required fields', $errors);
        }

        return true;
    }
protected function validate ( ) { $ errors = array ( ) ; foreach ( $ this -> requiredAttributes as $ requiredAttribute ) { if ( ! ArrayHelper :: keyExists ( $ this -> data , $ requiredAttribute ) ) { $ errors [ ] = $ requiredAttribute . ' is missing or empty' ; } } if ( count ( $ errors ) > 0 ) { throw new ValidationError ( get_called_class ( ) . ' object misses required fields' , $ errors ) ; } return true ; }
Check if object contains all of the required attributes
@throws ValidationError if some fields are missing
@return bool
Check if object contains all of the required attributes