public function validate($model, $validators = null)
    {
        if (isset($validators) && is_array($validators)) {
            $validation = $this->validateArray($model, $validators);
        } else {
            $validation = $this->validateModel($model);
        }
        if ($validation) {
            $errors = $validation->validate($model);
            if (count($errors)) {
                throw new ValidationException($errors);
            }
        }
    }
public function validate($model, $validators = null)
    {
        if (isset($validators) && is_array($validators)) {
            $validation = $this->validateArray($model, $validators);
        } else {
            $validation = $this->validateModel($model);
        }
        if ($validation) {
            $errors = $validation->validate($model);
            if (count($errors)) {
                throw new ValidationException($errors);
            }
        }
    }
public function validate ( $ model , $ validators = null ) { if ( isset ( $ validators ) && is_array ( $ validators ) ) { $ validation = $ this -> validateArray ( $ model , $ validators ) ; } else { $ validation = $ this -> validateModel ( $ model ) ; } if ( $ validation ) { $ errors = $ validation -> validate ( $ model ) ; if ( count ( $ errors ) ) { throw new ValidationException ( $ errors ) ; } } }
Validate model object

@param object|array $model
@param array $validators
@throws ValidationException
Validate model object