mirror of
https://github.com/ToxicCrack/PrintABrick.git
synced 2025-05-18 05:10:07 -07:00
Add RebrickableLoader
Loader to obtain Rebrickable database dump and load it to local database
This commit is contained in:
parent
1a9b856b3e
commit
0f7346068d
@ -18,8 +18,11 @@ services:
|
|||||||
arguments: ['@doctrine.orm.entity_manager', '@manager.brickset','@manager.rebrickable']
|
arguments: ['@doctrine.orm.entity_manager', '@manager.brickset','@manager.rebrickable']
|
||||||
|
|
||||||
loader.rebrickable:
|
loader.rebrickable:
|
||||||
class: AppBundle\Command\Loader\RebrickableLoader
|
class: AppBundle\Loader\RebrickableLoader
|
||||||
arguments: ['@doctrine.orm.entity_manager', '@manager.rebrickable', '%rebrickable_url%' ]
|
calls:
|
||||||
|
- [setArguments, ['@manager.rebrickable', '%rebrickable_url%']]
|
||||||
|
parent: service.loader
|
||||||
|
|
||||||
loader.ldraw:
|
loader.ldraw:
|
||||||
class: AppBundle\Command\Loader\LDrawLoader
|
class: AppBundle\Command\Loader\LDrawLoader
|
||||||
arguments: ['@doctrine.orm.entity_manager', '%kernel.root_dir%/../bin/ldview', '@oneup_flysystem.ldraw_filesystem', '%ldraw_url%']
|
arguments: ['@doctrine.orm.entity_manager', '%kernel.root_dir%/../bin/ldview', '@oneup_flysystem.ldraw_filesystem', '%ldraw_url%']
|
||||||
|
@ -3,32 +3,27 @@
|
|||||||
namespace AppBundle\Command;
|
namespace AppBundle\Command;
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
|
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
|
||||||
class LoadLibraryCommand extends ContainerAwareCommand
|
class LoadRebrickableDataCommand extends ContainerAwareCommand
|
||||||
{
|
{
|
||||||
protected function configure()
|
protected function configure()
|
||||||
{
|
{
|
||||||
$this
|
$this
|
||||||
->setName('app:load:library')
|
->setName('app:load:rebrickable')
|
||||||
->setDescription('Loads LDraw library parts')
|
->setDescription('Loads Rebrickable database')
|
||||||
->setHelp('This command allows you to..')
|
->setHelp('This command allows you to..');
|
||||||
->addArgument('ldraw', InputArgument::OPTIONAL, 'Path to LDraw library folder');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
$ldrawLoader = $this->getContainer()->get('loader.ldraw');
|
|
||||||
$ldrawLoader->setOutput($output);
|
|
||||||
|
|
||||||
$rebrickableLoader = $this->getContainer()->get('loader.rebrickable');
|
$rebrickableLoader = $this->getContainer()->get('loader.rebrickable');
|
||||||
$rebrickableLoader->setOutput($output);
|
$rebrickableLoader->setOutput($output);
|
||||||
|
|
||||||
try {
|
//TODO log errors
|
||||||
$ldrawLoader->loadModels($input->getArgument('ldraw'));
|
|
||||||
|
|
||||||
|
try {
|
||||||
$rebrickableLoader->loadColors();
|
$rebrickableLoader->loadColors();
|
||||||
|
|
||||||
$rebrickableLoader->loadParts();
|
$rebrickableLoader->loadParts();
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace AppBundle\Command\Loader;
|
namespace AppBundle\Loader;
|
||||||
|
|
||||||
use AppBundle\Api\Manager\RebrickableManager;
|
use AppBundle\Api\Manager\RebrickableManager;
|
||||||
use AppBundle\Entity\BuildingKit;
|
use AppBundle\Entity\BuildingKit;
|
||||||
@ -24,9 +24,8 @@ class RebrickableLoader extends Loader
|
|||||||
/**
|
/**
|
||||||
* ModelLoaderService constructor.
|
* ModelLoaderService constructor.
|
||||||
*/
|
*/
|
||||||
public function __construct($em, $rebrickableManager, $rebrickable_url)
|
public function setArguments($rebrickableManager, $rebrickable_url)
|
||||||
{
|
{
|
||||||
$this->em = $em;
|
|
||||||
$this->rebrickableManager = $rebrickableManager;
|
$this->rebrickableManager = $rebrickableManager;
|
||||||
$this->rebrickable_url = $rebrickable_url;
|
$this->rebrickable_url = $rebrickable_url;
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user