protected function assertEntityIsValid($entity, $scope = null)
    {
        if (!$this->validator) {
            throw new \BadMethodCallException(sprintf(
                'Method %s() cannot be used while validator is not configured.',
                __METHOD__
            ));
        }

        $scopes = $scope ? (array) $scope : null;

        $violationList = $this->validator->validate(
            $entity,
            null,
            $scopes
        );

        if (!count($violationList)) {
            return;
        }

        throw new ValidationException($entity, $violationList, $scopes);
    }
protected function assertEntityIsValid($entity, $scope = null)
    {
        if (!$this->validator) {
            throw new \BadMethodCallException(sprintf(
                'Method %s() cannot be used while validator is not configured.',
                __METHOD__
            ));
        }

        $scopes = $scope ? (array) $scope : null;

        $violationList = $this->validator->validate(
            $entity,
            null,
            $scopes
        );

        if (!count($violationList)) {
            return;
        }

        throw new ValidationException($entity, $violationList, $scopes);
    }
protected function assertEntityIsValid ( $ entity , $ scope = null ) { if ( ! $ this -> validator ) { throw new \ BadMethodCallException ( sprintf ( 'Method %s() cannot be used while validator is not configured.' , __METHOD__ ) ) ; } $ scopes = $ scope ? ( array ) $ scope : null ; $ violationList = $ this -> validator -> validate ( $ entity , null , $ scopes ) ; if ( ! count ( $ violationList ) ) { return ; } throw new ValidationException ( $ entity , $ violationList , $ scopes ) ; }
assert given entity is valid on given scope.

@param object       $entity
@param string|array $scope

@throws ValidationException If given object is invalid on given scope
assert given entity is valid on given scope .