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


PHP AbstractPlatform::supportsSequences方法代碼示例

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


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

示例1: up

 /**
  * {@inheritdoc}
  */
 public function up(Schema $schema, QueryBag $queries)
 {
     /**
      * After v1_3 migration
      * Undefined table: 7 ERROR:  relation "oro_dashboard_active_id_seq" does not exist
      */
     if ($this->platform->supportsSequences()) {
         $queries->addPostQuery('ALTER SEQUENCE IF EXISTS oro_dashboard_active_copy_id_seq RENAME TO oro_dashboard_active_id_seq;');
     }
 }
開發者ID:Maksold,項目名稱:platform,代碼行數:13,代碼來源:OroDashboardBundle.php

示例2: createSchema

 /**
  * Create a schema instance for the current database.
  * 
  * @return Schema
  */
 public function createSchema()
 {
     $sequences = array();
     if ($this->_platform->supportsSequences()) {
         $sequences = $this->listSequences();
     }
     $tables = $this->listTables();
     return new Schema($tables, $sequences, $this->createSchemaConfig());
 }
開發者ID:jff15,項目名稱:travelbot,代碼行數:14,代碼來源:AbstractSchemaManager.php

示例3: getRevisionId

 private function getRevisionId()
 {
     if ($this->revisionId === null) {
         $this->conn->insert($this->config->getRevisionTableName(), array('timestamp' => date_create('now'), 'username' => $this->config->getCurrentUsername()), array(Type::DATETIME, Type::STRING));
         $sequenceName = $this->platform->supportsSequences() ? $this->platform->getIdentitySequenceName($this->config->getRevisionTableName(), 'id') : null;
         $this->revisionId = $this->conn->lastInsertId($sequenceName);
     }
     return $this->revisionId;
 }
開發者ID:hayloft,項目名稱:EntityAudit,代碼行數:9,代碼來源:LogRevisionsListener.php

示例4: getRevisionId

 protected function getRevisionId()
 {
     if ($this->revisionId === null) {
         $this->auditEm->getConnection()->insert($this->config->getRevisionTableName(), array('timestamp' => date_create('now'), 'username' => $this->config->getCurrentUsername()), array(Type::DATETIME, Type::STRING));
         $sequenceName = $this->platform->supportsSequences() ? 'REVISIONS_ID_SEQ' : null;
         $this->revisionId = $this->auditEm->getConnection()->lastInsertId($sequenceName);
     }
     return $this->revisionId;
 }
開發者ID:bruery,項目名稱:platform,代碼行數:9,代碼來源:LogRevisionsListener.php

示例5: getDropSchemaSQL

    /**
     *
     * @param array $classes
     * @return array
     */
    public function getDropSchemaSQL(array $classes)
    {
        $sm = $this->_em->getConnection()->getSchemaManager();
        
        $sql = array();
        $orderedTables = array();

        foreach ($classes AS $class) {
            if ($class->isIdGeneratorSequence() && $class->name == $class->rootEntityName && $this->_platform->supportsSequences()) {
                $sql[] = $this->_platform->getDropSequenceSQL($class->sequenceGeneratorDefinition['sequenceName']);
            }
        }

        $commitOrder = $this->_getCommitOrder($classes);
        $associationTables = $this->_getAssociationTables($commitOrder);

        // Drop association tables first
        foreach ($associationTables as $associationTable) {
            if (!in_array($associationTable, $orderedTables)) {
                $orderedTables[] = $associationTable;
            }
        }

        // Drop tables in reverse commit order
        for ($i = count($commitOrder) - 1; $i >= 0; --$i) {
            $class = $commitOrder[$i];

            if (($class->isInheritanceTypeSingleTable() && $class->name != $class->rootEntityName)
                || $class->isMappedSuperclass) {
                continue;
            }

            if (!in_array($class->getTableName(), $orderedTables)) {
                $orderedTables[] = $class->getTableName();
            }
        }

        $dropTablesSql = array();
        foreach ($orderedTables AS $tableName) {
            /* @var $sm \Doctrine\DBAL\Schema\AbstractSchemaManager */
            $foreignKeys = $sm->listTableForeignKeys($tableName);
            foreach ($foreignKeys AS $foreignKey) {
                $sql[] = $this->_platform->getDropForeignKeySQL($foreignKey, $tableName);
            }
            $dropTablesSql[] = $this->_platform->getDropTableSQL($tableName);
        }

        return array_merge($sql, $dropTablesSql);
    }
開發者ID:pmjones,項目名稱:php-framework-benchmarks,代碼行數:54,代碼來源:SchemaTool.php

示例6: getDropSchemaSQL

 /**
  * Get SQL to drop the tables defined by the passed classes.
  * 
  * @param array $classes
  * @return array
  */
 public function getDropSchemaSQL(array $classes)
 {
     $visitor = new \Doctrine\DBAL\Schema\Visitor\DropSchemaSqlCollector($this->_platform);
     $schema = $this->getSchemaFromMetadata($classes);
     $sm = $this->_em->getConnection()->getSchemaManager();
     $fullSchema = $sm->createSchema();
     foreach ($fullSchema->getTables() as $table) {
         if (!$schema->hasTable($table->getName())) {
             foreach ($table->getForeignKeys() as $foreignKey) {
                 /* @var $foreignKey \Doctrine\DBAL\Schema\ForeignKeyConstraint */
                 if ($schema->hasTable($foreignKey->getForeignTableName())) {
                     $visitor->acceptForeignKey($table, $foreignKey);
                 }
             }
         } else {
             $visitor->acceptTable($table);
             foreach ($table->getForeignKeys() as $foreignKey) {
                 $visitor->acceptForeignKey($table, $foreignKey);
             }
         }
     }
     if ($this->_platform->supportsSequences()) {
         foreach ($schema->getSequences() as $sequence) {
             $visitor->acceptSequence($sequence);
         }
         foreach ($schema->getTables() as $table) {
             /* @var $sequence Table */
             foreach ($table->getIndexes() as $index) {
                 if ($index->isPrimary()) {
                     $columns = $index->getColumns();
                     if (count($columns) == 1) {
                         $checkSequence = $table->getName() . "_" . $columns[0] . "_seq";
                         if ($fullSchema->hasSequence($checkSequence)) {
                             $visitor->acceptSequence($fullSchema->getSequence($checkSequence));
                         }
                     }
                 }
             }
         }
     }
     return $visitor->getQueries();
 }
開發者ID:dracony,項目名稱:forked-php-orm-benchmark,代碼行數:48,代碼來源:SchemaTool.php

示例7: getDropSchema

 /**
  * Get the SQL Statements to drop the given schema from underlying db.
  *
  * @param Schema $dropSchema
  * @return array
  */
 public function getDropSchema(Schema $dropSchema)
 {
     $visitor = new DropSchemaSqlCollector($this->platform);
     $sm = $this->conn->getSchemaManager();
     $fullSchema = $sm->createSchema();
     foreach ($fullSchema->getTables() as $table) {
         if ($dropSchema->hasTable($table->getName())) {
             $visitor->acceptTable($table);
         }
         foreach ($table->getForeignKeys() as $foreignKey) {
             if (!$dropSchema->hasTable($table->getName())) {
                 continue;
             }
             if (!$dropSchema->hasTable($foreignKey->getForeignTableName())) {
                 continue;
             }
             $visitor->acceptForeignKey($table, $foreignKey);
         }
     }
     if (!$this->platform->supportsSequences()) {
         return $visitor->getQueries();
     }
     foreach ($dropSchema->getSequences() as $sequence) {
         $visitor->acceptSequence($sequence);
     }
     foreach ($dropSchema->getTables() as $table) {
         /* @var $sequence Table */
         if (!$table->hasPrimaryKey()) {
             continue;
         }
         $columns = $table->getPrimaryKey()->getColumns();
         if (count($columns) > 1) {
             continue;
         }
         $checkSequence = $table->getName() . "_" . $columns[0] . "_seq";
         if ($fullSchema->hasSequence($checkSequence)) {
             $visitor->acceptSequence($fullSchema->getSequence($checkSequence));
         }
     }
     return $visitor->getQueries();
 }
開發者ID:shinichi81,項目名稱:laravel4demo,代碼行數:47,代碼來源:SingleDatabaseSynchronizer.php

示例8: _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


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