當前位置: 首頁>>代碼示例>>PHP>>正文


PHP AbstractPlatform::supportsSchemas方法代碼示例

本文整理匯總了PHP中Doctrine\DBAL\Platforms\AbstractPlatform::supportsSchemas方法的典型用法代碼示例。如果您正苦於以下問題:PHP AbstractPlatform::supportsSchemas方法的具體用法?PHP AbstractPlatform::supportsSchemas怎麽用?PHP AbstractPlatform::supportsSchemas使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Doctrine\DBAL\Platforms\AbstractPlatform的用法示例。


在下文中一共展示了AbstractPlatform::supportsSchemas方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getTableName

 /**
  * {@inheritdoc}
  *
  * @todo Table names should be computed in DBAL depending on the platform
  */
 public function getTableName(ClassMetadata $class, AbstractPlatform $platform)
 {
     $tableName = $class->table['name'];
     if (!empty($class->table['schema'])) {
         $tableName = $class->table['schema'] . '.' . $class->table['name'];
         if (!$platform->supportsSchemas() && $platform->canEmulateSchemas()) {
             $tableName = $class->table['schema'] . '__' . $class->table['name'];
         }
     }
     return isset($class->table['quoted']) ? $platform->quoteIdentifier($tableName) : $tableName;
 }
開發者ID:Dren-x,項目名稱:mobitnew,代碼行數:16,代碼來源:DefaultQuoteStrategy.php

示例2: createSchema

 /**
  * Creates a schema instance for the current database.
  *
  * @return \Doctrine\DBAL\Schema\Schema
  */
 public function createSchema()
 {
     $namespaces = array();
     if ($this->_platform->supportsSchemas()) {
         $namespaces = $this->listNamespaceNames();
     }
     $sequences = array();
     if ($this->_platform->supportsSequences()) {
         $sequences = $this->listSequences();
     }
     $tables = $this->listTables();
     return new Schema($tables, $sequences, $this->createSchemaConfig(), $namespaces);
 }
開發者ID:pmaxs,項目名稱:dbal,代碼行數:18,代碼來源:AbstractSchemaManager.php

示例3: getQueries

 /**
  * Get all queries collected so far.
  *
  * @return array
  */
 public function getQueries()
 {
     $sql = array();
     foreach (array_keys($this->_createTableQueries) as $namespace) {
         if ($this->_platform->supportsSchemas()) {
             // TODO: Create Schema here
         }
     }
     foreach ($this->_createTableQueries as $schemaSql) {
         $sql = array_merge($sql, $schemaSql);
     }
     foreach ($this->_createSequenceQueries as $schemaSql) {
         $sql = array_merge($sql, $schemaSql);
     }
     foreach ($this->_createFkConstraintQueries as $schemaSql) {
         $sql = array_merge($sql, $schemaSql);
     }
     return $sql;
 }
開發者ID:jeanlopes,項目名稱:mostra-ifrs-poa,代碼行數:24,代碼來源:CreateSchemaSqlCollector.php

示例4: getQueries

 /**
  * Gets all queries collected so far.
  *
  * @return array
  */
 public function getQueries()
 {
     $sql = array();
     foreach (array_keys($this->createTableQueries) as $namespace) {
         if ($this->platform->supportsSchemas() && $this->platform->schemaNeedsCreation($namespace)) {
             $query = $this->platform->getCreateSchemaSQL($namespace);
             array_push($sql, $query);
         }
     }
     foreach ($this->createTableQueries as $schemaSql) {
         $sql = array_merge($sql, $schemaSql);
     }
     foreach ($this->createSequenceQueries as $schemaSql) {
         $sql = array_merge($sql, $schemaSql);
     }
     foreach ($this->createFkConstraintQueries as $schemaSql) {
         $sql = array_merge($sql, $schemaSql);
     }
     return $sql;
 }
開發者ID:kierkegaard13,項目名稱:graph-generator,代碼行數:25,代碼來源:CreateSchemaSqlCollector.php

示例5: getSchemaFromMetadata


//.........這裏部分代碼省略.........
                 // Parent class information is already contained in this class
                 $processedClasses[$parentClassName] = true;
             }
             foreach ($class->subClasses as $subClassName) {
                 $subClass = $this->em->getClassMetadata($subClassName);
                 $this->_gatherColumns($subClass, $table);
                 $this->_gatherRelationsSql($subClass, $table, $schema);
                 $processedClasses[$subClassName] = true;
             }
         } else {
             if ($class->isInheritanceTypeJoined()) {
                 // Add all non-inherited fields as columns
                 $pkColumns = array();
                 foreach ($class->fieldMappings as $fieldName => $mapping) {
                     if (!isset($mapping['inherited'])) {
                         $columnName = $this->quoteStrategy->getColumnName($mapping['fieldName'], $class, $this->platform);
                         $this->_gatherColumn($class, $mapping, $table);
                         if ($class->isIdentifier($fieldName)) {
                             $pkColumns[] = $columnName;
                         }
                     }
                 }
                 $this->_gatherRelationsSql($class, $table, $schema);
                 // Add the discriminator column only to the root table
                 if ($class->name == $class->rootEntityName) {
                     $this->addDiscriminatorColumnDefinition($class, $table);
                 } else {
                     // Add an ID FK column to child tables
                     /* @var \Doctrine\ORM\Mapping\ClassMetadata $class */
                     $idMapping = $class->fieldMappings[$class->identifier[0]];
                     $this->_gatherColumn($class, $idMapping, $table);
                     $columnName = $this->quoteStrategy->getColumnName($class->identifier[0], $class, $this->platform);
                     // TODO: This seems rather hackish, can we optimize it?
                     $table->getColumn($columnName)->setAutoincrement(false);
                     $pkColumns[] = $columnName;
                     // Add a FK constraint on the ID column
                     $table->addUnnamedForeignKeyConstraint($this->quoteStrategy->getTableName($this->em->getClassMetadata($class->rootEntityName), $this->platform), array($columnName), array($columnName), array('onDelete' => 'CASCADE'));
                 }
                 $table->setPrimaryKey($pkColumns);
             } else {
                 if ($class->isInheritanceTypeTablePerClass()) {
                     throw ORMException::notSupported();
                 } else {
                     $this->_gatherColumns($class, $table);
                     $this->_gatherRelationsSql($class, $table, $schema);
                 }
             }
         }
         $pkColumns = array();
         foreach ($class->identifier as $identifierField) {
             if (isset($class->fieldMappings[$identifierField])) {
                 $pkColumns[] = $this->quoteStrategy->getColumnName($identifierField, $class, $this->platform);
             } else {
                 if (isset($class->associationMappings[$identifierField])) {
                     /* @var $assoc \Doctrine\ORM\Mapping\OneToOne */
                     $assoc = $class->associationMappings[$identifierField];
                     foreach ($assoc['joinColumns'] as $joinColumn) {
                         $pkColumns[] = $this->quoteStrategy->getJoinColumnName($joinColumn, $class, $this->platform);
                     }
                 }
             }
         }
         if (!$table->hasIndex('primary')) {
             $table->setPrimaryKey($pkColumns);
         }
         if (isset($class->table['indexes'])) {
             foreach ($class->table['indexes'] as $indexName => $indexData) {
                 $table->addIndex($indexData['columns'], is_numeric($indexName) ? null : $indexName);
             }
         }
         if (isset($class->table['uniqueConstraints'])) {
             foreach ($class->table['uniqueConstraints'] as $indexName => $indexData) {
                 $table->addUniqueIndex($indexData['columns'], is_numeric($indexName) ? null : $indexName);
             }
         }
         if (isset($class->table['options'])) {
             foreach ($class->table['options'] as $key => $val) {
                 $table->addOption($key, $val);
             }
         }
         $processedClasses[$class->name] = true;
         if ($class->isIdGeneratorSequence() && $class->name == $class->rootEntityName) {
             $seqDef = $class->sequenceGeneratorDefinition;
             $quotedName = $this->quoteStrategy->getSequenceName($seqDef, $class, $this->platform);
             if (!$schema->hasSequence($quotedName)) {
                 $schema->createSequence($quotedName, $seqDef['allocationSize'], $seqDef['initialValue']);
             }
         }
         if ($eventManager->hasListeners(ToolEvents::postGenerateSchemaTable)) {
             $eventManager->dispatchEvent(ToolEvents::postGenerateSchemaTable, new GenerateSchemaTableEventArgs($class, $schema, $table));
         }
     }
     if (!$this->platform->supportsSchemas() && !$this->platform->canEmulateSchemas()) {
         $schema->visit(new RemoveNamespacedAssets());
     }
     if ($eventManager->hasListeners(ToolEvents::postGenerateSchema)) {
         $eventManager->dispatchEvent(ToolEvents::postGenerateSchema, new GenerateSchemaEventArgs($this->em, $schema));
     }
     return $schema;
 }
開發者ID:Herriniaina,項目名稱:iVarotra,代碼行數:101,代碼來源:SchemaTool.php

示例6: _toSql

 /**
  * @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform
  * @param boolean                                   $saveMode
  *
  * @return array
  */
 protected function _toSql(AbstractPlatform $platform, $saveMode = false)
 {
     $sql = array();
     if ($platform->supportsSchemas()) {
         foreach ($this->newNamespaces as $newNamespace) {
             $sql[] = $platform->getCreateSchemaSQL($newNamespace);
         }
     }
     if ($platform->supportsForeignKeyConstraints() && $saveMode == false) {
         foreach ($this->orphanedForeignKeys as $orphanedForeignKey) {
             $sql[] = $platform->getDropForeignKeySQL($orphanedForeignKey, $orphanedForeignKey->getLocalTableName());
         }
     }
     if ($platform->supportsSequences() == true) {
         foreach ($this->changedSequences as $sequence) {
             $sql[] = $platform->getAlterSequenceSQL($sequence);
         }
         if ($saveMode === false) {
             foreach ($this->removedSequences as $sequence) {
                 $sql[] = $platform->getDropSequenceSQL($sequence);
             }
         }
         foreach ($this->newSequences as $sequence) {
             $sql[] = $platform->getCreateSequenceSQL($sequence);
         }
     }
     $foreignKeySql = array();
     foreach ($this->newTables as $table) {
         $sql = array_merge($sql, $platform->getCreateTableSQL($table, AbstractPlatform::CREATE_INDEXES));
         if ($platform->supportsForeignKeyConstraints()) {
             foreach ($table->getForeignKeys() as $foreignKey) {
                 $foreignKeySql[] = $platform->getCreateForeignKeySQL($foreignKey, $table);
             }
         }
     }
     $sql = array_merge($sql, $foreignKeySql);
     if ($saveMode === false) {
         foreach ($this->removedTables as $table) {
             $sql[] = $platform->getDropTableSQL($table);
         }
     }
     foreach ($this->changedTables as $tableDiff) {
         $sql = array_merge($sql, $platform->getAlterTableSQL($tableDiff));
     }
     return $sql;
 }
開發者ID:Kevin-ZK,項目名稱:vaneDisk,代碼行數:52,代碼來源:SchemaDiff.php

示例7: getSequencePrefix

 /**
  * Gets the sequence name prefix based on class metadata.
  *
  * @param AbstractPlatform $platform
  * @return string
  *
  * @todo Sequence names should be computed in DBAL depending on the platform
  */
 public function getSequencePrefix(AbstractPlatform $platform)
 {
     $tableName = $this->getTableName();
     $sequencePrefix = $tableName;
     // Prepend the schema name to the table name if there is one
     if ($schemaName = $this->getSchemaName()) {
         $sequencePrefix = $schemaName . '.' . $tableName;
         if (!$platform->supportsSchemas() && $platform->canEmulateSchemas()) {
             $sequencePrefix = $schemaName . '__' . $tableName;
         }
     }
     return $sequencePrefix;
 }
開發者ID:guillaumeprost,項目名稱:ExerciceC2IS,代碼行數:21,代碼來源:ClassMetadataInfo.php

示例8: acceptNamespace

 /**
  * {@inheritdoc}
  */
 public function acceptNamespace($namespaceName)
 {
     if ($this->platform->supportsSchemas()) {
         $this->createNamespaceQueries = array_merge($this->createNamespaceQueries, (array) $this->platform->getCreateSchemaSQL($namespaceName));
     }
 }
開發者ID:BusinessCookies,項目名稱:CoffeeMachineProject,代碼行數:9,代碼來源:CreateSchemaSqlCollector.php

示例9: acceptNamespace

 /**
  * {@inheritdoc}
  */
 public function acceptNamespace($namespaceName)
 {
     if ($this->platform->supportsSchemas()) {
         $this->createNamespaceQueries[] = $this->platform->getCreateSchemaSQL($namespaceName);
     }
 }
開發者ID:ismailbaskin,項目名稱:dbal,代碼行數:9,代碼來源:CreateSchemaSqlCollector.php


注:本文中的Doctrine\DBAL\Platforms\AbstractPlatform::supportsSchemas方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。