当前位置: 首页>>代码示例>>PHP>>正文


PHP Type::overrideType方法代码示例

本文整理汇总了PHP中Doctrine\DBAL\Types\Type::overrideType方法的典型用法代码示例。如果您正苦于以下问题:PHP Type::overrideType方法的具体用法?PHP Type::overrideType怎么用?PHP Type::overrideType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Doctrine\DBAL\Types\Type的用法示例。


在下文中一共展示了Type::overrideType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: replaceImmutableTypes

 /**
  * Replaces default DateTime Doctrine types with their _immutable counterparts
  */
 public static function replaceImmutableTypes()
 {
     Type::overrideType(Type::DATE, DateTimeImmutable\DateImmutableType::class);
     Type::overrideType(Type::DATETIME, DateTimeImmutable\DateTimeImmutableType::class);
     Type::overrideType(Type::DATETIMETZ, DateTimeImmutable\DateTimeTzImmutableType::class);
     Type::overrideType(Type::TIME, DateTimeImmutable\TimeImmutableType::class);
 }
开发者ID:Aurielle,项目名称:Nette-Doctrine-DateTimeImmutable-Types,代码行数:10,代码来源:TypeRegistrar.php

示例2: __construct

 /**
  * @param array $options
  * @param \Zend_Cache_Core $cache
  * @param \Enlight_Hook_HookManager $hookManager
  */
 public function __construct($options, \Zend_Cache_Core $cache, \Enlight_Hook_HookManager $hookManager)
 {
     $this->setHookManager($hookManager);
     // Specifies the FQCN of a subclass of the EntityRepository.
     // That will be available for all entities without a custom repository class.
     $this->setDefaultRepositoryClassName('Shopware\\Components\\Model\\ModelRepository');
     $this->setProxyDir($options['proxyDir']);
     $this->setProxyNamespace($options['proxyNamespace']);
     $this->setAutoGenerateProxyClasses(AbstractProxyFactory::AUTOGENERATE_FILE_NOT_EXISTS);
     $this->setAttributeDir($options['attributeDir']);
     $this->setFileCacheDir($options['fileCacheDir']);
     $this->addEntityNamespace('Shopware', 'Shopware\\Models');
     $this->addEntityNamespace('Custom', 'Shopware\\CustomModels');
     Type::overrideType('datetime', 'Shopware\\Components\\Model\\DBAL\\Types\\DateTimeStringType');
     Type::overrideType('date', 'Shopware\\Components\\Model\\DBAL\\Types\\DateStringType');
     Type::overrideType('array', 'Shopware\\Components\\Model\\DBAL\\Types\\AllowInvalidArrayType');
     $this->addCustomStringFunction('DATE_FORMAT', 'Shopware\\Components\\Model\\Query\\Mysql\\DateFormat');
     $this->addCustomStringFunction('IFNULL', 'Shopware\\Components\\Model\\Query\\Mysql\\IfNull');
     $this->addCustomStringFunction('RegExp', 'Shopware\\Components\\Model\\Query\\Mysql\\RegExp');
     $this->addCustomStringFunction('Replace', 'Shopware\\Components\\Model\\Query\\Mysql\\Replace');
     // Load custom namespace for doctrine cache provider, if provided
     if (isset($options['cacheNamespace'])) {
         $this->cacheNamespace = $options['cacheNamespace'];
     }
     if (isset($options['cacheProvider'])) {
         $this->setCacheProvider($options['cacheProvider']);
     }
     if ($this->getMetadataCacheImpl() === null) {
         $this->setCacheResource($cache);
     }
 }
开发者ID:Goucher,项目名称:shopware,代码行数:36,代码来源:Configuration.php

示例3: setUp

 protected function setUp()
 {
     if (Type::hasType(ExtendedDataType::NAME)) {
         Type::overrideType(ExtendedDataType::NAME, 'JMS\\Payment\\CoreBundle\\Entity\\ExtendedDataType');
     } else {
         Type::addType(ExtendedDataType::NAME, 'JMS\\Payment\\CoreBundle\\Entity\\ExtendedDataType');
     }
 }
开发者ID:vidinoti,项目名称:JMSPaymentCoreBundle,代码行数:8,代码来源:ExtendedDataTypeTest.php

示例4: setUp

 public function setUp()
 {
     if (Type::hasType('json')) {
         Type::overrideType('json', 'Sonata\\Doctrine\\Types\\JsonType');
     } else {
         Type::addType('json', 'Sonata\\Doctrine\\Types\\JsonType');
     }
 }
开发者ID:saberyounis,项目名称:Sonata-Project,代码行数:8,代码来源:JsonTypeTest.php

示例5: addType

 /**
  * @param $name
  * @param $class
  *
  * @throws \Doctrine\DBAL\DBALException
  */
 public function addType($name, $class)
 {
     if (!Type::hasType($name)) {
         Type::addType($name, $class);
     } else {
         Type::overrideType($name, $class);
     }
 }
开发者ID:Devitek,项目名称:orm,代码行数:14,代码来源:CustomTypeManager.php

示例6: setUp

 protected function setUp()
 {
     if (DBALType::hasType('negative_to_positive')) {
         DBALType::overrideType('negative_to_positive', 'Doctrine\\Tests\\DbalTypes\\NegativeToPositiveType');
     } else {
         DBALType::addType('negative_to_positive', 'Doctrine\\Tests\\DbalTypes\\NegativeToPositiveType');
     }
     $this->_em = $this->_getTestEntityManager();
 }
开发者ID:selimcr,项目名称:servigases,代码行数:9,代码来源:UpdateSqlGenerationTest.php

示例7: setUpDBALTypes

 /**
  * Configures DBAL types required in tests
  */
 protected function setUpDBALTypes()
 {
     if (Type::hasType('jsonb')) {
         Type::overrideType('jsonb', 'Boldtrn\\JsonbBundle\\Types\\JsonbArrayType');
     } else {
         Type::addType('jsonb', 'Boldtrn\\JsonbBundle\\Types\\JsonbArrayType');
     }
     $this->connection->getDatabasePlatform()->registerDoctrineTypeMapping('JSONB', 'jsonb');
 }
开发者ID:adrienbrault,项目名称:JsonbBundle,代码行数:12,代码来源:BaseTest.php

示例8: setUp

 protected function setUp()
 {
     $this->generator = \Mockery::mock(EnumTypeGenerator::class);
     $this->storage = \Mockery::mock(EnumTypeStorage::class);
     $this->sut = new EnumTypeRegistry($this->generator, $this->storage);
     if (Type::hasType('foobar')) {
         Type::overrideType('foobar', null);
     }
 }
开发者ID:wirus15,项目名称:enum-bundle,代码行数:9,代码来源:EnumTypeRegistryTest.php

示例9: boot

 public function boot()
 {
     // Register custom data types
     if (!Type::hasType('uniqueidentifier')) {
         Type::addType('uniqueidentifier', 'Realestate\\MssqlBundle\\Types\\UniqueidentifierType');
     }
     Type::overrideType('date', 'Realestate\\MssqlBundle\\Types\\DateType');
     Type::overrideType('datetime', 'Realestate\\MssqlBundle\\Types\\DateTimeType');
 }
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:9,代码来源:RealestateMssqlBundle.php

示例10: initializeTypes

 private function initializeTypes()
 {
     foreach ($this->typesConfig as $type => $className) {
         if (Type::hasType($type)) {
             Type::overrideType($type, $className);
         } else {
             Type::addType($type, $className);
         }
     }
 }
开发者ID:rfc1483,项目名称:doctrine,代码行数:10,代码来源:ConnectionFactory.php

示例11: setUp

 protected function setUp()
 {
     if (DBALType::hasType(CustomIdObjectType::NAME)) {
         DBALType::overrideType(CustomIdObjectType::NAME, CustomIdObjectType::CLASSNAME);
     } else {
         DBALType::addType(CustomIdObjectType::NAME, CustomIdObjectType::CLASSNAME);
     }
     $this->useModelSet('custom_id_object_type');
     parent::setUp();
 }
开发者ID:selimcr,项目名称:servigases,代码行数:10,代码来源:CustomIdObjectTypeTest.php

示例12: setUp

 public function setUp()
 {
     // Type is a singleton.
     if (Type::hasType(self::TYPE_NAME)) {
         // Remove the type so it can be re-instantiated.
         Type::overrideType(self::TYPE_NAME, null);
     }
     Type::addType(self::TYPE_NAME, 'Omeka\\Db\\Type\\IpAddress');
     $this->ipAddress = Type::getType(self::TYPE_NAME);
     $this->platform = $this->getMockForAbstractClass('Doctrine\\DBAL\\Platforms\\AbstractPlatform');
 }
开发者ID:patrova,项目名称:omeka-s,代码行数:11,代码来源:IpAddressTest.php

示例13: __construct

 /**
  * {@inheritDoc}
  */
 public function __construct()
 {
     parent::__construct();
     $this->initializeDoctrineTypeMappings();
     if (!Type::hasType(MapType::NAME)) {
         Type::addType(MapType::NAME, 'Crate\\DBAL\\Types\\MapType');
     }
     if (!Type::hasType(TimestampType::NAME)) {
         Type::addType(TimestampType::NAME, 'Crate\\DBAL\\Types\\TimestampType');
     }
     Type::overrideType('array', 'Crate\\DBAL\\Types\\ArrayType');
 }
开发者ID:crate,项目名称:crate-dbal,代码行数:15,代码来源:CratePlatform.php

示例14: testSerialization

 public function testSerialization()
 {
     $array = array('a' => 'b');
     $encoded = base64_encode(serialize($array));
     $platform = TestUtil::getEntityManager()->getConnection()->getDatabasePlatform();
     Type::overrideType(Type::TARRAY, 'Oro\\DBAL\\Types\\ArrayType');
     $type = Type::getType(Type::TARRAY);
     $actualDbValue = $type->convertToDatabaseValue($array, $platform);
     $this->assertEquals($encoded, $actualDbValue);
     $this->assertEquals($array, $type->convertToPHPValue($actualDbValue, $platform));
     $this->assertEquals($array, $type->convertToPHPValue($encoded, $platform));
 }
开发者ID:sergeyz,项目名称:doctrine-extensions,代码行数:12,代码来源:ArrayTypeTest.php

示例15: initializeTypes

 /**
  * initialize the types
  */
 private function initializeTypes()
 {
     foreach ($this->typesConfig as $type => $typeConfig) {
         if (Type::hasType($type)) {
             Type::overrideType($type, $typeConfig['class']);
         } else {
             Type::addType($type, $typeConfig['class']);
         }
         if ($typeConfig['commented']) {
             $this->commentedTypes[] = $type;
         }
     }
 }
开发者ID:joan16v,项目名称:symfony2_test,代码行数:16,代码来源:ConnectionFactory.php


注:本文中的Doctrine\DBAL\Types\Type::overrideType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。