当前位置: 首页>>代码示例>>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;未经允许,请勿转载。