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


PHP AbstractPlatform::getDropSequenceSQL方法代碼示例

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


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

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

示例2: getQueries

 /**
  * @return array
  */
 public function getQueries()
 {
     $sql = array();
     foreach ($this->constraints as $fkConstraint) {
         $localTable = $this->constraints[$fkConstraint];
         $sql[] = $this->platform->getDropForeignKeySQL($fkConstraint, $localTable);
     }
     foreach ($this->sequences as $sequence) {
         $sql[] = $this->platform->getDropSequenceSQL($sequence);
     }
     foreach ($this->tables as $table) {
         $sql[] = $this->platform->getDropTableSQL($table);
     }
     return $sql;
 }
開發者ID:RuntyCybin,項目名稱:csymfony,代碼行數:18,代碼來源:DropSchemaSqlCollector.php

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

示例4: dropSequence

 /**
  * Drops a sequence with a given name.
  *
  * @param string $name The name of the sequence to drop.
  */
 public function dropSequence($name)
 {
     $this->_execSql($this->_platform->getDropSequenceSQL($name));
 }
開發者ID:jff15,項目名稱:travelbot,代碼行數:9,代碼來源:AbstractSchemaManager.php

示例5: acceptSequence

 /**
  * @param Sequence $sequence
  */
 public function acceptSequence(Sequence $sequence)
 {
     $this->_sequences[] = $this->_platform->getDropSequenceSQL($sequence->getQuotedName($this->_platform));
 }
開發者ID:MarS2806,項目名稱:Zend-Framework--Doctrine-ORM--PHPUnit--Ant--Jenkins-CI--TDD-,代碼行數:7,代碼來源:DropSchemaSqlCollector.php


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