コード例 #1
0
 public function testExecute()
 {
     $tableName = 'foo';
     $this->createTable($tableName);
     $this->assertTrue($this->tableExists($tableName));
     $dropTableCommand = new DropTableCommand();
     $dropTableCommand->setConnection($this->connection)->setEventDispatcher($this->getMock('Symfony\\Component\\EventDispatcher\\EventDispatcher'))->setTable(new Table($tableName))->execute();
     $this->assertFalse($this->tableExists($tableName));
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 public function execute()
 {
     $getTablesCommand = new GetTablesCommand();
     $getTablesCommand->setConnection($this->connection);
     $tables = $getTablesCommand->execute();
     $this->preExecute();
     foreach ($tables as $table) {
         $dropTable = new DropTableCommand();
         $dropTable->setTable($table)->cascade()->setConnection($this->connection)->setEventDispatcher($this->dispatcher);
         $this->sql .= $dropTable->getSql();
         $dropTable->execute();
     }
     $this->postExecute();
     return true;
 }