public function validateObject($instance)
    {
        if (null !== $this->validator) {
            $violations = $this->validator->validate($instance);

            if (!empty($violations)) {
                throw new ValidationException($violations);
            }
        }
    }
public function validateObject($instance)
    {
        if (null !== $this->validator) {
            $violations = $this->validator->validate($instance);

            if (!empty($violations)) {
                throw new ValidationException($violations);
            }
        }
    }
public function validateObject ( $ instance ) { if ( null !== $ this -> validator ) { $ violations = $ this -> validator -> validate ( $ instance ) ; if ( ! empty ( $ violations ) ) { throw new ValidationException ( $ violations ) ; } } }
Validate the object instance.

@param object $instance The object instance

@throws ValidationException When an error exist
Validate the object instance .