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)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
$loadModelsCommand = $this->getApplication()->find('app:load:models');
|
// Load LDraw data
|
||||||
|
|
||||||
$loadModelsInput = [
|
$loadLDrawCommand = $this->getApplication()->find('app:load:ldraw');
|
||||||
'command' => 'app:load:models',
|
$loadLDrawInput = [
|
||||||
|
'command' => 'app:load:ldraw',
|
||||||
'--all' => true,
|
'--all' => true,
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($ldraw = $input->getOption('ldraw')) {
|
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) {
|
if ($returnCode) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Load Rebrickable data
|
||||||
|
|
||||||
$loadRebrickableCommad = $this->getApplication()->find('app:load:rebrickable');
|
$loadRebrickableCommad = $this->getApplication()->find('app:load:rebrickable');
|
||||||
$returnCode = $loadRebrickableCommad->run(new ArrayInput(['command' => 'app:load:rebrickable']), $output);
|
$returnCode = $loadRebrickableCommad->run(new ArrayInput(['command' => 'app:load:rebrickable']), $output);
|
||||||
|
|
||||||
@ -50,14 +53,8 @@ class InitDataCommand extends ContainerAwareCommand
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$loadRelationsCommand = $this->getApplication()->find('app:load:relations');
|
// Load images
|
||||||
|
|
||||||
$returnCode = $loadRelationsCommand->run(new ArrayInput(['command' => 'app:load:relations']), $output);
|
|
||||||
|
|
||||||
if ($returnCode) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
$loadImagesCommand = $this->getApplication()->find('app:load:images');
|
$loadImagesCommand = $this->getApplication()->find('app:load:images');
|
||||||
$returnCode = $loadImagesCommand->run(new ArrayInput([
|
$returnCode = $loadImagesCommand->run(new ArrayInput([
|
||||||
'command' => 'app:load:images',
|
'command' => 'app:load:images',
|
||||||
@ -70,13 +67,6 @@ class InitDataCommand extends ContainerAwareCommand
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$elasticIndex = $this->getApplication()->find('fos:elastic:populate');
|
|
||||||
$returnCode = $elasticIndex->run(null, $output);
|
|
||||||
|
|
||||||
if ($returnCode) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ use Symfony\Component\Console\Input\InputInterface;
|
|||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
|
||||||
class LoadModelImagesCommand extends ContainerAwareCommand
|
class LoadImagesCommand extends ContainerAwareCommand
|
||||||
{
|
{
|
||||||
protected function configure()
|
protected function configure()
|
||||||
{
|
{
|
@ -10,14 +10,14 @@ use Symfony\Component\Console\Input\InputInterface;
|
|||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
|
||||||
class LoadModelsCommand extends ContainerAwareCommand
|
class LoadLdrawCommand extends ContainerAwareCommand
|
||||||
{
|
{
|
||||||
use LockableTrait;
|
use LockableTrait;
|
||||||
|
|
||||||
protected function configure()
|
protected function configure()
|
||||||
{
|
{
|
||||||
$this
|
$this
|
||||||
->setName('app:load:models')
|
->setName('app:load:ldraw')
|
||||||
->setDescription('Loads LDraw library models into database')
|
->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.')
|
->setHelp('This command allows you to load LDraw library models into database while converting .dat files to .stl format.')
|
||||||
->setDefinition(
|
->setDefinition(
|
@ -4,6 +4,7 @@ namespace AppBundle\Command;
|
|||||||
|
|
||||||
use League\Flysystem\Exception;
|
use League\Flysystem\Exception;
|
||||||
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
|
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
|
||||||
|
use Symfony\Component\Console\Input\ArrayInput;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
|
||||||
@ -29,5 +30,24 @@ class LoadRebrickableDataCommand extends ContainerAwareCommand
|
|||||||
|
|
||||||
return 1;
|
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