Adds a to each console command->execute()
This commit is contained in:
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
namespace LotGD\Core\Console\Command;
|
||||
|
||||
use LotGD\Core\Models\Character;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
@@ -26,7 +27,7 @@ class CharacterListCommand extends BaseCommand
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$io = new SymfonyStyle($input, $output);
|
||||
$characters = $this->game->getEntityManager()->getRepository(Character::class)->findAll();
|
||||
@@ -41,5 +42,7 @@ class CharacterListCommand extends BaseCommand
|
||||
}
|
||||
|
||||
$io->table(...$table);
|
||||
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
namespace LotGD\Core\Console\Command;
|
||||
|
||||
use LotGD\Core\Models\Character;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputDefinition;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
@@ -33,7 +34,7 @@ class CharacterResetViewpointCommand extends BaseCommand
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$io = new SymfonyStyle($input, $output);
|
||||
$id = $input->getOption("id");
|
||||
@@ -50,5 +51,7 @@ class CharacterResetViewpointCommand extends BaseCommand
|
||||
$character->setViewpoint(null);
|
||||
|
||||
$this->game->getEntityManager()->flush();
|
||||
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace LotGD\Core\Console\Command;
|
||||
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
@@ -24,7 +25,7 @@ class ConsoleCommand extends BaseCommand
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
print "Daenerys console, the dragon prompt. lotgd/core " . \LotGD\Core\Game::getVersion() . ".\n";
|
||||
print "Enter some PHP, but be careful, this is live and attached to your currently configured setup:\n\n";
|
||||
@@ -39,5 +40,7 @@ class ConsoleCommand extends BaseCommand
|
||||
'g' => $this->game,
|
||||
]);
|
||||
$boris->start();
|
||||
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,8 +25,10 @@ class DatabaseInitCommand extends BaseCommand
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$this->game->getEntityManager()->flush();
|
||||
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ class DatabaseSchemaUpdateCommand extends BaseCommand
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$entityManager = $this->game->getEntityManager();
|
||||
$metaData = $entityManager->getMetadataFactory()->getAllMetadata();
|
||||
@@ -34,5 +34,7 @@ class DatabaseSchemaUpdateCommand extends BaseCommand
|
||||
$schemaTool->updateSchema($metaData);
|
||||
|
||||
$entityManager->flush();
|
||||
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@ namespace LotGD\Core\Console\Command;
|
||||
|
||||
use LotGD\Core\Exceptions\ClassNotFoundException;
|
||||
use LotGD\Core\Exceptions\ModuleAlreadyExistsException;
|
||||
|
||||
use LotGD\Core\LibraryConfiguration;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
@@ -29,7 +29,7 @@ class ModuleRegisterCommand extends BaseCommand
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$io = new SymfonyStyle($input, $output);
|
||||
$modules = $this->game->getComposerManager()->getModulePackages();
|
||||
@@ -38,6 +38,8 @@ class ModuleRegisterCommand extends BaseCommand
|
||||
foreach ($modules as $p) {
|
||||
$this->registerModule($p->getName(), $io, $registered);
|
||||
}
|
||||
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,6 +3,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace LotGD\Core\Console\Command;
|
||||
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
@@ -24,7 +25,7 @@ class ModuleValidateCommand extends BaseCommand
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$results = $this->game->getModuleManager()->validate();
|
||||
|
||||
@@ -35,6 +36,7 @@ class ModuleValidateCommand extends BaseCommand
|
||||
return 1;
|
||||
}
|
||||
$output->writeln("<info>LotGD modules validated</info>");
|
||||
return 0;
|
||||
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ use Monolog\Logger;
|
||||
*/
|
||||
class Game
|
||||
{
|
||||
private $entityManager;
|
||||
private EntityManagerInterface $entityManager;
|
||||
private $eventManager;
|
||||
private $composerManager;
|
||||
private $moduleManager;
|
||||
|
||||
Reference in New Issue
Block a user