lib/Doctrine/ORM/Tools/SchemaTool.php
public function getDropSchemaSQL(array $classes)
    {
        $visitor = new 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 */
                if ($table->hasPrimaryKey()) {
                    $columns = $table->getPrimaryKey()->getColumns();
                    if (count($columns) === 1) {
                        $checkSequence = $table->getName() . '_' . $columns[0] . '_seq';
                        if ($fullSchema->hasSequence($checkSequence)) {
                            $visitor->acceptSequence($fullSchema->getSequence($checkSequence));
                        }
                    }
                }
            }
        }

        return $visitor->getQueries();
    }
public function getDropSchemaSQL(array $classes)
    {
        $visitor = new 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 */
                if ($table->hasPrimaryKey()) {
                    $columns = $table->getPrimaryKey()->getColumns();
                    if (count($columns) === 1) {
                        $checkSequence = $table->getName() . '_' . $columns[0] . '_seq';
                        if ($fullSchema->hasSequence($checkSequence)) {
                            $visitor->acceptSequence($fullSchema->getSequence($checkSequence));
                        }
                    }
                }
            }
        }

        return $visitor->getQueries();
    }
public function getDropSchemaSQL ( array $ classes ) { $ visitor = new 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 */ if ( $ table -> hasPrimaryKey ( ) ) { $ columns = $ table -> getPrimaryKey ( ) -> getColumns ( ) ; if ( count ( $ columns ) === 1 ) { $ checkSequence = $ table -> getName ( ) . '_' . $ columns [ 0 ] . '_seq' ; if ( $ fullSchema -> hasSequence ( $ checkSequence ) ) { $ visitor -> acceptSequence ( $ fullSchema -> getSequence ( $ checkSequence ) ) ; } } } } } return $ visitor -> getQueries ( ) ; }
Gets SQL to drop the tables defined by the passed classes.

@param ClassMetadata[] $classes

@return string[]
Gets SQL to drop the tables defined by the passed classes .