Doctrine\ODM\MongoDB\Mapping\MappingException::typeExists PHP Method

typeExists() public static method

public static typeExists ( string $name ) : MappingException
$name string
return MappingException
    public static function typeExists($name)
    {
        return new self('Type ' . $name . ' already exists.');
    }

Usage Example

Example #1
0
 /**
  * Adds a custom type to the type map.
  *
  * @static
  * @param string $name Name of the type. This should correspond to what getName() returns.
  * @param string $className The class name of the custom type.
  * @throws MappingException
  */
 public static function addType($name, $className)
 {
     if (isset(self::$typesMap[$name])) {
         throw MappingException::typeExists($name);
     }
     self::$typesMap[$name] = $className;
 }