protected function newConstraint($name, $options = null)
    {
        if (false !== strpos($name, '\\') && class_exists($name)) {
            $className = (string) $name;
        } elseif (false !== strpos($name, ':')) {
            list($prefix, $className) = explode(':', $name, 2);

            if (!isset($this->namespaces[$prefix])) {
                throw new MappingException(sprintf('Undefined namespace prefix "%s"', $prefix));
            }

            $className = $this->namespaces[$prefix].$className;
        } else {
            $className = self::DEFAULT_NAMESPACE.$name;
        }

        return new $className($options);
    }
protected function newConstraint($name, $options = null)
    {
        if (false !== strpos($name, '\\') && class_exists($name)) {
            $className = (string) $name;
        } elseif (false !== strpos($name, ':')) {
            list($prefix, $className) = explode(':', $name, 2);

            if (!isset($this->namespaces[$prefix])) {
                throw new MappingException(sprintf('Undefined namespace prefix "%s"', $prefix));
            }

            $className = $this->namespaces[$prefix].$className;
        } else {
            $className = self::DEFAULT_NAMESPACE.$name;
        }

        return new $className($options);
    }
protected function newConstraint ( $ name , $ options = null ) { if ( false !== strpos ( $ name , '\\' ) && class_exists ( $ name ) ) { $ className = ( string ) $ name ; } elseif ( false !== strpos ( $ name , ':' ) ) { list ( $ prefix , $ className ) = explode ( ':' , $ name , 2 ) ; if ( ! isset ( $ this -> namespaces [ $ prefix ] ) ) { throw new MappingException ( sprintf ( 'Undefined namespace prefix "%s"' , $ prefix ) ) ; } $ className = $ this -> namespaces [ $ prefix ] . $ className ; } else { $ className = self :: DEFAULT_NAMESPACE . $ name ; } return new $ className ( $ options ) ; }
Creates a new constraint instance for the given constraint name.

@param string $name    The constraint name. Either a constraint relative
to the default constraint namespace, or a fully
qualified class name. Alternatively, the constraint
may be preceded by a namespace alias and a colon.
The namespace alias must have been defined using
{@link addNamespaceAlias()}.
@param mixed  $options The constraint options

@return Constraint

@throws MappingException If the namespace prefix is undefined
Creates a new constraint instance for the given constraint name .