mirror of
https://github.com/ToxicCrack/PrintABrick.git
synced 2025-05-29 02:00:18 -07:00
Update commands
This commit is contained in:
parent
bc9efea8c3
commit
8e545de793
@ -26,23 +26,26 @@ class InitDataCommand extends ContainerAwareCommand
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$loadModelsCommand = $this->getApplication()->find('app:load:models');
|
||||
// Load LDraw data
|
||||
|
||||
$loadModelsInput = [
|
||||
'command' => 'app:load:models',
|
||||
$loadLDrawCommand = $this->getApplication()->find('app:load:ldraw');
|
||||
$loadLDrawInput = [
|
||||
'command' => 'app:load:ldraw',
|
||||
'--all' => true,
|
||||
];
|
||||
|
||||
if ($ldraw = $input->getOption('ldraw')) {
|
||||
$loadModelsInput['--ldraw'] = $ldraw;
|
||||
$loadLDrawInput['--ldraw'] = $ldraw;
|
||||
}
|
||||
|
||||
$returnCode = $loadModelsCommand->run(new ArrayInput($loadModelsInput), $output);
|
||||
$returnCode = $loadLDrawCommand->run(new ArrayInput($loadLDrawInput), $output);
|
||||
|
||||
if ($returnCode) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Load Rebrickable data
|
||||
|
||||
$loadRebrickableCommad = $this->getApplication()->find('app:load:rebrickable');
|
||||
$returnCode = $loadRebrickableCommad->run(new ArrayInput(['command' => 'app:load:rebrickable']), $output);
|
||||
|
||||
@ -50,13 +53,7 @@ class InitDataCommand extends ContainerAwareCommand
|
||||
return 1;
|
||||
}
|
||||
|
||||
$loadRelationsCommand = $this->getApplication()->find('app:load:relations');
|
||||
|
||||
$returnCode = $loadRelationsCommand->run(new ArrayInput(['command' => 'app:load:relations']), $output);
|
||||
|
||||
if ($returnCode) {
|
||||
return 1;
|
||||
}
|
||||
// Load images
|
||||
|
||||
$loadImagesCommand = $this->getApplication()->find('app:load:images');
|
||||
$returnCode = $loadImagesCommand->run(new ArrayInput([
|
||||
@ -70,13 +67,6 @@ class InitDataCommand extends ContainerAwareCommand
|
||||
return 1;
|
||||
}
|
||||
|
||||
$elasticIndex = $this->getApplication()->find('fos:elastic:populate');
|
||||
$returnCode = $elasticIndex->run(null, $output);
|
||||
|
||||
if ($returnCode) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class LoadModelImagesCommand extends ContainerAwareCommand
|
||||
class LoadImagesCommand extends ContainerAwareCommand
|
||||
{
|
||||
protected function configure()
|
||||
{
|
@ -10,14 +10,14 @@ use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class LoadModelsCommand extends ContainerAwareCommand
|
||||
class LoadLdrawCommand extends ContainerAwareCommand
|
||||
{
|
||||
use LockableTrait;
|
||||
|
||||
protected function configure()
|
||||
{
|
||||
$this
|
||||
->setName('app:load:models')
|
||||
->setName('app:load:ldraw')
|
||||
->setDescription('Loads LDraw library models into database')
|
||||
->setHelp('This command allows you to load LDraw library models into database while converting .dat files to .stl format.')
|
||||
->setDefinition(
|
@ -4,6 +4,7 @@ namespace AppBundle\Command;
|
||||
|
||||
use League\Flysystem\Exception;
|
||||
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
|
||||
use Symfony\Component\Console\Input\ArrayInput;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
@ -29,5 +30,24 @@ class LoadRebrickableDataCommand extends ContainerAwareCommand
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Load relations between LDraw models and Rebrickable parts
|
||||
$loadRelationsCommand = $this->getApplication()->find('app:load:relations');
|
||||
|
||||
$returnCode = $loadRelationsCommand->run(new ArrayInput(['command' => 'app:load:relations']), $output);
|
||||
|
||||
if ($returnCode) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Populate Index
|
||||
$elasticIndex = $this->getApplication()->find('fos:elastic:populate');
|
||||
$returnCode = $elasticIndex->run($input, $output);
|
||||
|
||||
if ($returnCode) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user