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


PHP Types\Type类代码示例

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


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

示例1: setType

 /**
  * {@inheritdoc}
  */
 public function setType(Type $type)
 {
     if ($this->constructed) {
         $this->setOptions([OroOptions::KEY => [ExtendOptionsManager::TYPE_OPTION => $type->getName()]]);
     }
     return parent::setType($type);
 }
开发者ID:xamin123,项目名称:platform,代码行数:10,代码来源:ExtendColumn.php

示例2: getTypeByDoctrineType

 public static function getTypeByDoctrineType(Type $type)
 {
     $mapping = array_flip(self::$mapping);
     if (isset($mapping[$type->getName()])) {
         return $mapping[$type->getName()];
     } else {
         return TableInterface::TYPE_VARCHAR;
     }
 }
开发者ID:seytar,项目名称:psx,代码行数:9,代码来源:SerializeTrait.php

示例3: isCommentedDoctrineType

 /**
  * {@inheritdoc}
  */
 public function isCommentedDoctrineType(Type $doctrineType)
 {
     if ($doctrineType->getName() === Type::BOOLEAN) {
         // We require a commented boolean type in order to distinguish between boolean and smallint
         // as both (have to) map to the same native type.
         return true;
     }
     return parent::isCommentedDoctrineType($doctrineType);
 }
开发者ID:doctrine,项目名称:dbal,代码行数:12,代码来源:DB2Platform.php

示例4: doctrineColumnLookup

 public function doctrineColumnLookup($col_lookup)
 {
     if (isset($this->options['expr']) && isset($col_lookup[$this->options['expr']])) {
         /**
          * @var $col Column
          */
         $col = $col_lookup[$this->options['expr']];
         $this->type = $col->getType();
         $this->typeName = self::simplifyTypeName($this->type->getName());
     }
 }
开发者ID:kevinmel2000,项目名称:crudkit,代码行数:11,代码来源:SQLColumn.php

示例5: changePrimaryKeyType

 /**
  * @param Schema   $schema
  * @param QueryBag $queries
  * @param string   $tableName
  * @param string   $columnName
  * @param string   $type
  *
  * @throws \Exception
  */
 public function changePrimaryKeyType(Schema $schema, QueryBag $queries, $tableName, $columnName, $type)
 {
     $targetColumn = $schema->getTable($tableName)->getColumn($columnName);
     $type = Type::getType($type);
     if ($targetColumn->getType() === $type) {
         return;
     }
     /** @var ForeignKeyConstraint[] $foreignKeys */
     $foreignKeys = [];
     foreach ($schema->getTables() as $table) {
         /** @var ForeignKeyConstraint[] $tableForeignKeys */
         $tableForeignKeys = array_filter($table->getForeignKeys(), function (ForeignKeyConstraint $tableForeignKey) use($tableName, $columnName) {
             if ($tableForeignKey->getForeignTableName() !== $tableName) {
                 return false;
             }
             return $tableForeignKey->getForeignColumns() === [$columnName];
         });
         foreach ($tableForeignKeys as $tableForeignKey) {
             $foreignKeys[$tableForeignKey->getName()] = $tableForeignKey;
             $foreignKeyTableName = $tableForeignKey->getLocalTable()->getName();
             $foreignKeyColumnNames = $tableForeignKey->getLocalColumns();
             $queries->addPreQuery($this->platform->getDropForeignKeySQL($tableForeignKey, $foreignKeyTableName));
             $column = $schema->getTable($foreignKeyTableName)->getColumn(reset($foreignKeyColumnNames));
             if ($column instanceof ExtendColumn) {
                 $column->disableExtendOptions()->setType($type)->enableExtendOptions();
             } else {
                 $column->setType($type);
             }
         }
     }
     $targetColumn->setType($type);
     foreach ($foreignKeys as $foreignKey) {
         $queries->addPostQuery($this->platform->getCreateForeignKeySQL($foreignKey, $foreignKey->getLocalTable()));
     }
 }
开发者ID:Maksold,项目名称:platform,代码行数:44,代码来源:ChangeTypeExtension.php

示例6: 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

示例7: convertResultsInternal

 protected function convertResultsInternal($results, AbstractPlatform $platform, CaseSensor $sensor)
 {
     if (is_array($results)) {
         $results = current($results);
     }
     return Type::getType($this->type)->convertToPHPValue($results, $platform);
 }
开发者ID:ritalin,项目名称:omelet,代码行数:7,代码来源:BuiltinDomain.php

示例8: _getPortableTableColumnDefinition

 /**
  * {@inheritdoc}
  */
 protected function _getPortableTableColumnDefinition($tableColumn)
 {
     $tableColumn = array_change_key_case($tableColumn, \CASE_LOWER);
     $length = null;
     $fixed = null;
     $unsigned = false;
     $scale = false;
     $precision = false;
     $type = $this->_platform->getDoctrineTypeMapping($tableColumn['typename']);
     switch (strtolower($tableColumn['typename'])) {
         case 'varchar':
             $length = $tableColumn['length'];
             $fixed = false;
             break;
         case 'character':
             $length = $tableColumn['length'];
             $fixed = true;
             break;
         case 'clob':
             $length = $tableColumn['length'];
             break;
         case 'decimal':
         case 'double':
         case 'real':
             $scale = $tableColumn['scale'];
             $precision = $tableColumn['length'];
             break;
     }
     $options = array('length' => $length, 'unsigned' => (bool) $unsigned, 'fixed' => (bool) $fixed, 'default' => $tableColumn['default'] == "NULL" ? null : $tableColumn['default'], 'notnull' => (bool) ($tableColumn['nulls'] == 'N'), 'scale' => null, 'precision' => null, 'platformOptions' => array());
     if ($scale !== null && $precision !== null) {
         $options['scale'] = $scale;
         $options['precision'] = $precision;
     }
     return new Column($tableColumn['colname'], \Doctrine\DBAL\Types\Type::getType($type), $options);
 }
开发者ID:RuntyCybin,项目名称:csymfony,代码行数:38,代码来源:DB2SchemaManager.php

示例9: buildForm

 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $schemaManager = $this->container['db']->getSchemaManager();
     foreach ($schemaManager->listTableColumns($this->table) as $column) {
         // here we try to display nicely database relations w/ foreign keys
         if (false !== strpos($column->getName(), '_id')) {
             $table = str_replace('_id', '', $column->getName());
             $dataMap = new DataMap($this->container['db'], $schemaManager);
             $choices = $dataMap->mapForeignKeys($table, $column);
             if (is_array($choices)) {
                 $column->setType(Type::getType('array'));
             }
         }
         switch ($column->getType()) {
             case 'Integer':
                 $builder->add($column->getName(), 'integer', array('read_only' => $column->getName() === 'id' ? true : false, 'required' => $column->getNotNull()));
                 break;
             case 'Array':
                 $builder->add($column->getName(), 'choice', array('choices' => $choices, 'required' => $column->getNotNull()));
                 break;
             case 'Boolean':
                 $builder->add($column->getName(), 'checkbox', array('required' => false));
                 break;
             case 'String':
                 $builder->add($column->getName(), 'text', array('required' => $column->getNotNull()));
                 break;
             case 'Text':
                 $builder->add($column->getName(), 'textarea', array('required' => $column->getNotNull()));
                 break;
         }
     }
 }
开发者ID:wisembly,项目名称:silexcms,代码行数:32,代码来源:RowType.php

示例10: setUp

 protected function setUp()
 {
     parent::setUp();
     DDC2494TinyIntType::$calls = array();
     Type::addType('ddc2494_tinyint', __NAMESPACE__ . '\\DDC2494TinyIntType');
     $this->_schemaTool->createSchema(array($this->_em->getClassMetadata(DDC2494Currency::CLASSNAME), $this->_em->getClassMetadata(DDC2494Campaign::CLASSNAME)));
 }
开发者ID:pnaq57,项目名称:zf2demo,代码行数:7,代码来源:DDC2494Test.php

示例11: setUp

 protected function setUp()
 {
     parent::setUp();
     Type::addType(DDC2012TsVectorType::MYTYPE, __NAMESPACE__ . '\\DDC2012TsVectorType');
     DDC2012TsVectorType::$calls = array();
     $this->_schemaTool->createSchema(array($this->_em->getClassMetadata(__NAMESPACE__ . '\\DDC2012Item'), $this->_em->getClassMetadata(__NAMESPACE__ . '\\DDC2012ItemPerson')));
 }
开发者ID:Herriniaina,项目名称:iVarotra,代码行数:7,代码来源:DDC2012Test.php

示例12: createService

 /**
  * Create service
  *
  * @param  ServiceLocatorInterface $validators
  * @return mixed
  */
 public function createService(ServiceLocatorInterface $validators)
 {
     if (isset($this->options['enum'])) {
         $this->options['enum'] = DoctrineType::getType($this->options['enum']);
     }
     return new EnumValidator($this->options);
 }
开发者ID:bvoronov,项目名称:zb-utils,代码行数:13,代码来源:EnumValidatorFactory.php

示例13: boot

 public function boot()
 {
     if (!Type::hasType('branch_logo')) {
         Type::addType('branch_logo', 'Diamante\\DeskBundle\\Infrastructure\\Persistence\\Doctrine\\DBAL\\Types\\BranchLogoType');
     }
     if (!Type::hasType('priority')) {
         Type::addType('priority', 'Diamante\\DeskBundle\\Infrastructure\\Persistence\\Doctrine\\DBAL\\Types\\TicketPriorityType');
     }
     if (!Type::hasType('file')) {
         Type::addType('file', 'Diamante\\DeskBundle\\Infrastructure\\Persistence\\Doctrine\\DBAL\\Types\\AttachmentFileType');
     }
     if (!Type::hasType('status')) {
         Type::addType('status', 'Diamante\\DeskBundle\\Infrastructure\\Persistence\\Doctrine\\DBAL\\Types\\TicketStatusType');
     }
     if (!Type::hasType('source')) {
         Type::addType('source', 'Diamante\\DeskBundle\\Infrastructure\\Persistence\\Doctrine\\DBAL\\Types\\TicketSourceType');
     }
     if (!Type::hasType('ticket_sequence_number')) {
         Type::addType('ticket_sequence_number', 'Diamante\\DeskBundle\\Infrastructure\\Persistence\\Doctrine\\DBAL\\Types\\TicketSequenceNumberType');
     }
     if (!Type::hasType('ticket_unique_id')) {
         Type::addType('ticket_unique_id', 'Diamante\\DeskBundle\\Infrastructure\\Persistence\\Doctrine\\DBAL\\Types\\TicketUniqueIdType');
     }
     foreach ($this->dataAuditTypes as $type) {
         if (!AuditFieldTypeRegistry::hasType($type)) {
             AuditFieldTypeRegistry::addType($type, $type);
         }
     }
     $em = $this->container->get('doctrine.orm.default_entity_manager');
     $conn = $em->getConnection();
     $conn->getDatabasePlatform()->registerDoctrineTypeMapping('FILE', 'string');
 }
开发者ID:northdakota,项目名称:diamantedesk-application,代码行数:32,代码来源:DiamanteDeskBundle.php

示例14: getEntityManager

 public static function getEntityManager($smart = FALSE, $path_to_entity = null, $proxyPath = null, $proxyNamespace = null)
 {
     if (empty(self::$em)) {
         if ($path_to_entity === NULL) {
             //$path_to_entity = PATH_ROOT . '/' . Sokol::getApp()->name . '/Entity';
             $path_to_entity = PATH_ROOT . '/Entity';
         }
         $isDev = Sokol::getApp()->isDev;
         $connectionParams = Sokol::getConfig('db');
         //---Table Prefix---
         $tablePrefix = !empty($connectionParams['tablePrefix']) ? $connectionParams['tablePrefix'] : null;
         if ($tablePrefix) {
             $evm = new EventManager();
             $tablePrefix = new TablePrefix($tablePrefix);
             $evm->addEventListener(Events::loadClassMetadata, $tablePrefix);
         }
         //---/Table Prefix---
         if ($smart) {
             self::$em = self::getEmSmart($path_to_entity, $isDev, $connectionParams, $evm);
         } else {
             if ($proxyPath === NULL) {
                 $proxyPath = PATH_ROOT . '/' . Sokol::getApp()->name . '/Proxy';
             }
             if ($proxyNamespace === NULL) {
                 $proxyNamespace = Sokol::getApp()->getNamespace() . '\\Proxy';
             }
             self::$em = self::getEm($path_to_entity, $isDev, $connectionParams, $evm, $proxyPath, $proxyNamespace);
         }
         //подключаем тип данных "html"
         Type::addType('html', 'Sokol\\Doctrine\\Extension\\HtmlType');
         self::$em->getConnection()->getDatabasePlatform()->registerDoctrineTypeMapping('db_html', 'html');
     }
     return self::$em;
 }
开发者ID:php-nik,项目名称:sokol,代码行数:34,代码来源:Doctrine.php

示例15: loadClassMetadata

 /**
  * Adds doctrine point type
  *
  * @param LoadClassMetadataEventArgs $eventArgs
  */
 public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs)
 {
     $classMetadata = $eventArgs->getClassMetadata();
     if (null === $classMetadata->reflClass) {
         return;
     }
     if ($this->isGeocodable($classMetadata)) {
         if (!Type::hasType('point')) {
             Type::addType('point', 'Knp\\DoctrineBehaviors\\DBAL\\Types\\PointType');
         }
         $em = $eventArgs->getEntityManager();
         $con = $em->getConnection();
         // skip non-postgres platforms
         if (!$con->getDatabasePlatform() instanceof PostgreSqlPlatform && !$con->getDatabasePlatform() instanceof MySqlPlatform) {
             return;
         }
         // skip platforms with registerd stuff
         if (!$con->getDatabasePlatform()->hasDoctrineTypeMappingFor('point')) {
             $con->getDatabasePlatform()->registerDoctrineTypeMapping('point', 'point');
             if ($con->getDatabasePlatform() instanceof PostgreSqlPlatform) {
                 $em->getConfiguration()->addCustomNumericFunction('DISTANCE', 'Knp\\DoctrineBehaviors\\ORM\\Geocodable\\Query\\AST\\Functions\\DistanceFunction');
             }
         }
         $classMetadata->mapField(['fieldName' => 'location', 'type' => 'point', 'nullable' => true]);
     }
 }
开发者ID:adampiotrowski,项目名称:DoctrineBehaviors,代码行数:31,代码来源:GeocodableSubscriber.php


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