Doctrine\ODM\MongoDB\Mapping\Types\Type::addType PHP Method

addType() public static method

Adds a custom type to the type map.
public static addType ( string $name, string $className )
$name string Name of the type. This should correspond to what getName() returns.
$className string The class name of the custom type.
    public static function addType($name, $className)
    {
        if (isset(self::$typesMap[$name])) {
            throw MongoDBException::typeExists($name);
        }

        self::$typesMap[$name] = $className;
    }

Usage Example

 public static function setUpBeforeClass()
 {
     Type::addType('date_collection', __NAMESPACE__ . '\\DateCollectionType');
 }