Doctrine\OXM\Types\Type::overrideType PHP Method

overrideType() public static method

Overrides an already defined type to use a different implementation.
public static overrideType ( string $name, string $className )
$name string
$className string
    public static function overrideType($name, $className)
    {
        if (!isset(self::$_typesMap[$name])) {
            throw OXMException::typeNotFound($name);
        }
        self::$_typesMap[$name] = $className;
        unset(self::$_typeObjects[$name]);
    }

Usage Example

Example #1
0
 /**
  * @backupStaticAttributes enabled
  */
 public function testOverrideTypeAlreadyInstantiated()
 {
     Type::getType('string');
     Type::overrideType('string', 'Doctrine\\Tests\\Mocks\\TypeMock');
     $this->assertInstanceOf('Doctrine\\Tests\\Mocks\\TypeMock', Type::getType('string'));
 }