/** * Dumps the database to an output function. * * @param callable $output A function that will be called with every SQL statement. * * @return void */ public function dumpDatabase(callable $output) { foreach ($this->driver->getPreDumpSql() as $sql) { $output($sql); } foreach (self::OBJECT_TYPES as $objectType) { foreach ($this->driver->getObjects($objectType) as $name) { $output($this->driver->getCreateSql($objectType, $name)); if ($objectType == self::OBJECT_TABLE) { $this->dumpTableData($name, $output); } } } foreach ($this->driver->getPostDumpSql() as $sql) { $output($sql); } }