protected function truncateResources()
 {
     $resourcesTables = $this->prepareResourcesTables($this->resources);
     foreach ($resourcesTables as $resourceTable) {
         $this->dbWrite->truncateTable($resourceTable);
     }
     return $resourcesTables;
 }
Ejemplo n.º 2
0
 /**
  * Loop through resource groups and truncate tables
  *
  * @return void
  */
 protected function truncateResourceGroups()
 {
     foreach ($this->groups as $name => $resources) {
         $this->prepareResources($resources);
         if (!count($resources)) {
             continue;
         }
         array_walk($resources, array($this, 'prepareArrayForTableOutput'));
         if (!$this->force) {
             $this->output->writeln(sprintf('<info>%s</info> table(s):', $name));
             $table = new Table($this->output);
             $table->setRows($resources)->render();
             $confirm = $this->dialog->askConfirmation($this->output, '<question>Truncate table(s)?</question> ', false);
             if (!$confirm) {
                 continue;
             }
         }
         foreach ($resources as $resourceName) {
             if (!$resourceName[0]) {
                 continue;
             }
             $this->dbWrite->truncateTable($resourceName[0]);
             $this->output->writeln(sprintf('Truncate <info>%s</info>', $resourceName[0]));
         }
     }
 }