예제 #1
0
 /**
  * Counts the number of objects to dump, including the table rows.
  *
  * @param callable $output A function that will be called for every count.
  *
  * @return void
  */
 public function countObjects(callable $output)
 {
     $output(count($this->driver->getPreDumpSql()));
     foreach (self::OBJECT_TYPES as $objectType) {
         $objects = $this->driver->getObjects($objectType);
         $output(count($objects));
         if ($objectType == self::OBJECT_TABLE) {
             foreach ($objects as $tableName) {
                 $tableName = $this->driver->quoteIdentifier($tableName);
                 $rows = $this->pdo->query("SELECT COUNT(*) FROM {$tableName}")->fetchColumn();
                 $output($rows);
             }
         }
     }
     $output(count($this->driver->getPostDumpSql()));
 }