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


PHP Type::registerType方法代码示例

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


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

示例1: setUp

 /**
  * setup type we want to test
  *
  * @return void
  */
 public function setUp()
 {
     Type::registerType('extref', 'Graviton\\DocumentBundle\\Types\\ExtReference');
     $this->doubles['router'] = $this->getMockBuilder('\\Symfony\\Bundle\\FrameworkBundle\\Routing\\Router')->disableOriginalConstructor()->setMethods(array('getRouteCollection', 'generate'))->getMock();
     $this->doubles['collection'] = $this->getMockBuilder('\\Symfony\\Bundle\\FrameworkBundle\\Routing\\RouteCollection')->setMethods(array('all'))->getMock();
     $this->doubles['routes'] = [new Route('/core/app/{id}', ['_controller' => 'graviton.core.controller.app:getAction', '_format' => '~'], ['_method' => 'GET', 'id' => '[a-zA-Z0-9\\-_\\/]+']), new Route('/core/app', ['_controller' => 'graviton.core.controller.app.appAction', '_format' => '~'], ['_method' => 'GET']), new Route('/i18n/language/{id}', ['_controller' => 'graviton.i18n.controller.language:getAction', '_format' => '~'], ['_method' => 'GET', 'id' => '[a-zA-Z0-9\\-_\\/]+']), new Route('/hans/showcase/{id}', ['_controller' => 'gravitondyn.showcase.controller.showcase:getAction', '_format' => '~'], ['_method' => 'GET', 'id' => '[a-zA-Z0-9\\-_\\/]+'])];
 }
开发者ID:smoskalenko,项目名称:graviton,代码行数:12,代码来源:ExtReferenceTest.php

示例2: __construct

 /**
  * Register cuctom doctrine types
  */
 public function __construct()
 {
     if (class_exists('\\Doctrine\\ODM\\MongoDB\\Types\\Type')) {
         \Doctrine\ODM\MongoDB\Types\Type::registerType(self::ODM_ENTITIES_TYPE, 'Pim\\Bundle\\CatalogBundle\\MongoDB\\Type\\Entities');
         \Doctrine\ODM\MongoDB\Types\Type::registerType(self::ODM_ENTITY_TYPE, 'Pim\\Bundle\\CatalogBundle\\MongoDB\\Type\\Entity');
     }
 }
开发者ID:javiersantos,项目名称:pim-community-dev,代码行数:10,代码来源:PimCatalogBundle.php

示例3: __construct

 /**
  * Register custom doctrine types
  */
 public function __construct()
 {
     if (class_exists('\\Doctrine\\ODM\\MongoDB\\Types\\Type')) {
         \Doctrine\ODM\MongoDB\Types\Type::registerType(self::ODM_ENTITIES_TYPE, 'Akeneo\\Bundle\\StorageUtilsBundle\\Doctrine\\MongoDBODM\\Types\\Entities');
         \Doctrine\ODM\MongoDB\Types\Type::registerType(self::ODM_ENTITY_TYPE, 'Akeneo\\Bundle\\StorageUtilsBundle\\Doctrine\\MongoDBODM\\Types\\Entity');
     }
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:10,代码来源:AkeneoStorageUtilsBundle.php

示例4: __construct

 /**
  * initialize bundle
  */
 public function __construct()
 {
     // TODO: implement ExtReferenceArrayType
     Type::registerType('extref', Types\ExtReferenceType::class);
     Type::registerType('hash', Types\HashType::class);
     Type::registerType('hasharray', Types\HashArrayType::class);
     Type::registerType('datearray', Types\DateArrayType::class);
 }
开发者ID:alebon,项目名称:graviton,代码行数:11,代码来源:GravitonDocumentBundle.php

示例5: checkCoordinateType

 /**
  * @param ClassMetadata $classMetadata
  */
 protected function checkCoordinateType(ClassMetadata $classMetadata)
 {
     foreach ($classMetadata->fieldMappings as $fieldName => $mapping) {
         if (isset($mapping['cubiche:coordinate'])) {
             $type = 'Coordinate';
             if (!Type::hasType($type)) {
                 Type::registerType($type, CoordinateType::class);
             }
             $classMetadata->fieldMappings[$fieldName]['type'] = $type;
         }
     }
 }
开发者ID:cubiche,项目名称:cubiche,代码行数:15,代码来源:EventListener.php

示例6: checkIdType

 /**
  * @param ClassMetadata $classMetadata
  *
  * @throws MappingException
  */
 protected function checkIdType(ClassMetadata $classMetadata)
 {
     foreach ($classMetadata->fieldMappings as $fieldName => $mapping) {
         if (isset($mapping['cubiche:id'])) {
             $idMapping = $mapping['cubiche:id'];
             $type = str_replace('\\', '.', $idMapping['type']);
             if (!Type::hasType($type)) {
                 Type::registerType($type, DynamicIdType::class);
                 Type::getType($type)->setTargetClass($idMapping['type']);
             }
             $classMetadata->fieldMappings[$fieldName]['type'] = $type;
         }
     }
 }
开发者ID:cubiche,项目名称:cubiche,代码行数:19,代码来源:EventListener.php

示例7: checkTypes

 /**
  * @param ClassMetadata $classMetadata
  */
 protected function checkTypes(ClassMetadata $classMetadata)
 {
     $types = array_keys($this->typeMapping);
     foreach ($classMetadata->fieldMappings as $fieldName => $mapping) {
         foreach ($types as $type) {
             if (isset($mapping['cubiche:' . $type])) {
                 $typeName = substr($this->typeMapping[$type], strrpos($this->typeMapping[$type], '\\') + 1);
                 if (!Type::hasType($typeName)) {
                     Type::registerType($typeName, $this->typeMapping[$type]);
                 }
                 $classMetadata->fieldMappings[$fieldName]['type'] = $typeName;
                 break;
             }
         }
     }
 }
开发者ID:cubiche,项目名称:cubiche,代码行数:19,代码来源:EventListener.php

示例8: bootstrapDoctrine

 public function bootstrapDoctrine(MvcEvent $event)
 {
     $serviceManager = $event->getApplication()->getServiceManager();
     /** @var Options\ModuleOptions $moduleOptions */
     $moduleOptions = $serviceManager->get(__NAMESPACE__ . '\\Options\\ModuleOptions');
     if ($moduleOptions->getDoctrine()->registerUuidType()) {
         if (!class_exists('Rhumsaa\\Uuid\\Uuid')) {
             throw new Exception\RuntimeException('Failed to register "uuid" Doctrine mapping type: ' . 'Missing required class Rhumsaa\\Uuid\\Uuid');
         }
         if (class_exists(DoctrineOrmTypes\Type::CLASS)) {
             DoctrineOrmTypes\Type::addType(DoctrineUuidType::NAME, DoctrineUuidType::CLASS);
         }
         if (class_exists(DoctrineOdmTypes\Type::CLASS)) {
             DoctrineOdmTypes\Type::registerType(DoctrineOdmUuidType::NAME, DoctrineOdmUuidType::CLASS);
         }
     }
     if ($moduleOptions->getDoctrine()->registerDatetimeImmutableType()) {
         if (class_exists(DoctrineOdmTypes\Type::CLASS)) {
             DoctrineOdmTypes\Type::registerType(DoctrineOdmDateTimeImmutType::NAME, DoctrineOdmDateTimeImmutType::CLASS);
         }
     }
     if ($moduleOptions->getDoctrine()->registerDatetimeNoTzType()) {
         if (class_exists(DoctrineOdmTypes\Type::CLASS)) {
             DoctrineOdmTypes\Type::registerType(DoctrineOdmDateTimeNoTzType::NAME, DoctrineOdmDateTimeNoTzType::CLASS);
         }
     }
     if ($moduleOptions->getDoctrine()->registerDatetimeImmutableNoTzType()) {
         if (class_exists(DoctrineOdmTypes\Type::CLASS)) {
             DoctrineOdmTypes\Type::registerType(DoctrineOdmDateTimeImmutNoTzType::NAME, DoctrineOdmDateTimeImmutNoTzType::CLASS);
         }
     }
     //        /** @var \Zend\ServiceManager\ServiceManager $serviceManager */
     //        $serviceManager = $event->getApplication()->getServiceManager();
     //
     //        /** @var \Doctrine\ORM\EntityManager $entityManager */
     //        $entityManager = $serviceManager->get('Doctrine\ORM\EntityManager');
     //        $entityManager->getConnection()->getDatabasePlatform()->registerDoctrineTypeMapping('db_mytype', 'mytype');
 }
开发者ID:detailnet,项目名称:dfw-persistence-module,代码行数:38,代码来源:Module.php

示例9: __construct

 public function __construct()
 {
     Type::registerType('dough_money', 'Dough\\Doctrine\\ODM\\MongoDB\\Type\\DoughMoneyType');
 }
开发者ID:merk,项目名称:dough,代码行数:4,代码来源:DoughMoneyTypeTest.php

示例10: setUp

 /**
  * setup type we want to test
  *
  * @return void
  */
 public function setUp()
 {
     Type::registerType('extref', ExtReferenceType::class);
     $this->type = Type::getType('extref');
 }
开发者ID:alebon,项目名称:graviton,代码行数:10,代码来源:ExtReferenceTypeTest.php

示例11: setUp

 /**
  * setup type we want to test
  *
  * @return void
  */
 public function setUp()
 {
     Type::registerType('datearray', DateArrayType::class);
     $this->type = Type::getType('datearray');
 }
开发者ID:alebon,项目名称:graviton,代码行数:10,代码来源:DateArrayTypeTest.php

示例12: __construct

 public function __construct()
 {
     Type::registerType('dough_currency_money', 'Dough\\Doctrine\\ODM\\MongoDB\\Type\\DoughCurrencyMoneyType');
     Type::registerType('dough_currency_money_hash', 'Dough\\Doctrine\\ODM\\MongoDB\\Type\\DoughCurrencyMoneyHashType');
 }
开发者ID:merk,项目名称:dough,代码行数:5,代码来源:DoughCurrencyMoneyHashTest.php

示例13: setUp

 /**
  * setup type we want to test
  *
  * @return void
  */
 public function setUp()
 {
     Type::registerType('hash', 'Graviton\\DocumentBundle\\Types\\HashType');
     $this->type = Type::getType('hash');
 }
开发者ID:alebon,项目名称:graviton,代码行数:10,代码来源:HashTypeTest.php

示例14: __construct

 /**
  * initialize bundle
  */
 public function __construct()
 {
     Type::registerType('extref', 'Graviton\\DocumentBundle\\Types\\ExtReference');
 }
开发者ID:smoskalenko,项目名称:graviton,代码行数:7,代码来源:GravitonDocumentBundle.php

示例15: setUp

 /**
  * setup type we want to test
  *
  * @return void
  */
 public function setUp()
 {
     Type::registerType('hasharray', HashArrayType::class);
     $this->type = Type::getType('hasharray');
 }
开发者ID:alebon,项目名称:graviton,代码行数:10,代码来源:HashArrayTypeTest.php


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