當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。