Skip to content

Commit

Permalink
SymfonyConsole: support lazy loading of commands
Browse files Browse the repository at this point in the history
  • Loading branch information
JanTvrdik committed Jan 25, 2018
1 parent 641135d commit f0ce888
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/Bridges/SymfonyConsole/ContinueCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@

class ContinueCommand extends BaseCommand
{
/** @var string */
protected static $defaultName = 'migrations:continue';


protected function configure()
{
$this->setName('migrations:continue');
$this->setName(self::$defaultName);
$this->setDescription('Updates database schema by running all new migrations');
$this->setHelp("If table 'migrations' does not exist in current database, it is created automatically.");
}
Expand Down
5 changes: 4 additions & 1 deletion src/Bridges/SymfonyConsole/CreateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ class CreateCommand extends BaseCommand
const CONTENT_SOURCE_STDIN = 'stdin';
const CONTENT_SOURCE_EMPTY = 'empty';

/** @var string */
protected static $defaultName = 'migrations:create';

/** @var string */
protected $defaultContentSource = self::CONTENT_SOURCE_DIFF;

Expand All @@ -44,7 +47,7 @@ public function setDefaultContentSource($defaultContentSource)
*/
protected function configure()
{
$this->setName('migrations:create');
$this->setName(self::$defaultName);
$this->setDescription('Creates new migration file with proper name (e.g. 2015-03-14-130836-label.sql)');
$this->setHelp('Prints path of the created file to standard output.');

Expand Down
5 changes: 4 additions & 1 deletion src/Bridges/SymfonyConsole/ResetCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@

class ResetCommand extends BaseCommand
{
/** @var string */
protected static $defaultName = 'migrations:reset';

protected function configure()
{
$this->setName('migrations:reset');
$this->setName(self::$defaultName);
$this->setDescription('Drops current database and recreates it from scratch');
$this->setHelp("Drops current database and runs all migrations");
}
Expand Down

0 comments on commit f0ce888

Please sign in to comment.