Elgg  Version master
DatabaseSeedersCommand.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg\Cli;
4 
7 
12 
16  protected function configure() {
17  $this->setName('database:seeders')
18  ->setDescription(elgg_echo('cli:database:seeders:description'));
19  }
20 
24  protected function command() {
25  $table = new Table($this->output);
26 
27  $table->setHeaders([
28  elgg_echo('cli:database:seeders:handler'),
29  elgg_echo('cli:database:seeders:type'),
30  elgg_echo('cli:database:seeders:count'),
31  ]);
32 
34  $seeders = _elgg_services()->seeder->getSeederClasses();
35 
36  foreach ($seeders as $seeder) {
37  /* @var $seed Seed */
38  $seed = new $seeder();
39 
40  $table->addRow([
41  $seeder,
42  $seed::getType(),
43  $seed->getCount(),
44  ]);
45  }
46  });
47 
48  $table->render();
49 
50  return self::SUCCESS;
51  }
52 }
elgg_call(int $flags, Closure $closure)
Calls a callable autowiring the arguments using public DI services and applying logic based on flags...
Definition: elgglib.php:299
elgg_echo(string $message_key, array $args=[], string $language= '')
Elgg language module Functions to manage language and translations.
Definition: languages.php:17
const ELGG_IGNORE_ACCESS
elgg_call() flags
Definition: constants.php:130
const ELGG_SHOW_DISABLED_ENTITIES
Definition: constants.php:132
$table
Definition: user.php:37
Abstract command with some utility methods.
Definition: Command.php:12
_elgg_services()
Get the global service provider.
Definition: elgglib.php:346