diff --git a/app/config/services.yml b/app/config/services.yml index 21eb13b..1f94483 100644 --- a/app/config/services.yml +++ b/app/config/services.yml @@ -18,8 +18,11 @@ services: arguments: ['@doctrine.orm.entity_manager', '@manager.brickset','@manager.rebrickable'] loader.rebrickable: - class: AppBundle\Command\Loader\RebrickableLoader - arguments: ['@doctrine.orm.entity_manager', '@manager.rebrickable', '%rebrickable_url%' ] + class: AppBundle\Loader\RebrickableLoader + calls: + - [setArguments, ['@manager.rebrickable', '%rebrickable_url%']] + parent: service.loader + loader.ldraw: class: AppBundle\Command\Loader\LDrawLoader arguments: ['@doctrine.orm.entity_manager', '%kernel.root_dir%/../bin/ldview', '@oneup_flysystem.ldraw_filesystem', '%ldraw_url%'] diff --git a/src/AppBundle/Command/LoadLibraryCommand.php b/src/AppBundle/Command/LoadRebrickableDataCommand.php similarity index 59% rename from src/AppBundle/Command/LoadLibraryCommand.php rename to src/AppBundle/Command/LoadRebrickableDataCommand.php index d96d211..089e4e5 100644 --- a/src/AppBundle/Command/LoadLibraryCommand.php +++ b/src/AppBundle/Command/LoadRebrickableDataCommand.php @@ -3,32 +3,27 @@ namespace AppBundle\Command; use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; -use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -class LoadLibraryCommand extends ContainerAwareCommand +class LoadRebrickableDataCommand extends ContainerAwareCommand { protected function configure() { $this - ->setName('app:load:library') - ->setDescription('Loads LDraw library parts') - ->setHelp('This command allows you to..') - ->addArgument('ldraw', InputArgument::OPTIONAL, 'Path to LDraw library folder'); + ->setName('app:load:rebrickable') + ->setDescription('Loads Rebrickable database') + ->setHelp('This command allows you to..'); } protected function execute(InputInterface $input, OutputInterface $output) { - $ldrawLoader = $this->getContainer()->get('loader.ldraw'); - $ldrawLoader->setOutput($output); - $rebrickableLoader = $this->getContainer()->get('loader.rebrickable'); $rebrickableLoader->setOutput($output); - try { - $ldrawLoader->loadModels($input->getArgument('ldraw')); + //TODO log errors + try { $rebrickableLoader->loadColors(); $rebrickableLoader->loadParts(); diff --git a/src/AppBundle/Command/Loader/RebrickableLoader.php b/src/AppBundle/Loader/RebrickableLoader.php similarity index 98% rename from src/AppBundle/Command/Loader/RebrickableLoader.php rename to src/AppBundle/Loader/RebrickableLoader.php index 2009394..a313bba 100644 --- a/src/AppBundle/Command/Loader/RebrickableLoader.php +++ b/src/AppBundle/Loader/RebrickableLoader.php @@ -1,6 +1,6 @@ em = $em; $this->rebrickableManager = $rebrickableManager; $this->rebrickable_url = $rebrickable_url; }