diff --git a/app/config/config.yml b/app/config/config.yml index e415e26..91c89d3 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -7,12 +7,15 @@ imports: # http://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration parameters: locale: en + # rebrickable csv files root URL rebrickable_url: 'http://rebrickable.com/media/downloads/' - ldraw_url: 'http://www.ldraw.org/library/updates/completeCA.zip' + # LDraw library zip file URL + ldraw_url: 'http://www.ldraw.org/library/updates/complete.zip' framework: #esi: ~ - #translator: { fallbacks: ["%locale%"] } + translator: + fallbacks: ["%locale%"] secret: "%secret%" router: resource: "%kernel.root_dir%/config/routing.yml" diff --git a/app/config/service/api.yml b/app/config/service/api.yml index c1debc3..23290ef 100644 --- a/app/config/service/api.yml +++ b/app/config/service/api.yml @@ -1,14 +1,14 @@ services: - client.brickset: + api.client.brickset: class: AppBundle\Api\Client\Brickset\Brickset arguments: ['%brickset_apikey%'] - client.rebrickable: + api.client.rebrickable: class: AppBundle\Api\Client\Rebrickable\Rebrickable_v3 arguments: ['%rebrickable_apikey%'] - manager.brickset: + api.manager.brickset: class: AppBundle\Api\Manager\BricksetManager - arguments: ['@client.brickset'] - manager.rebrickable: + arguments: ['@api.client.brickset'] + api.manager.rebrickable: class: AppBundle\Api\Manager\RebrickableManager - arguments: ['@client.rebrickable'] \ No newline at end of file + arguments: ['@api.client.rebrickable'] \ No newline at end of file diff --git a/app/config/service/service.yml b/app/config/service/service.yml index ba38c4a..f69f787 100644 --- a/app/config/service/service.yml +++ b/app/config/service/service.yml @@ -11,9 +11,10 @@ services: app.form.filter_set: class: AppBundle\Form\FilterSetType - arguments: ['@manager.brickset'] + arguments: ['@api.manager.brickset'] tags: - - { name: form.type } app.relation.mapper: + - { name: form.type } + app.relation.mapper: class: AppBundle\Utils\RelationMapper arguments: diff --git a/src/AppBundle/Command/LoadLDRawLibraryCommand.php b/src/AppBundle/Command/LoadLDRawLibraryCommand.php index cef5bd5..0d94f07 100644 --- a/src/AppBundle/Command/LoadLDRawLibraryCommand.php +++ b/src/AppBundle/Command/LoadLDRawLibraryCommand.php @@ -20,7 +20,7 @@ class LoadLDRawLibraryCommand extends ContainerAwareCommand protected function execute(InputInterface $input, OutputInterface $output) { - $ldrawLoader = $this->getContainer()->get('loader.ldraw'); + $ldrawLoader = $this->getContainer()->get('service.loader.ldraw'); $ldrawLoader->setOutput($output); //TODO log errors diff --git a/src/AppBundle/Command/LoadRebrickableDataCommand.php b/src/AppBundle/Command/LoadRebrickableDataCommand.php index 3afa1fb..a9c441e 100644 --- a/src/AppBundle/Command/LoadRebrickableDataCommand.php +++ b/src/AppBundle/Command/LoadRebrickableDataCommand.php @@ -18,7 +18,7 @@ class LoadRebrickableDataCommand extends ContainerAwareCommand protected function execute(InputInterface $input, OutputInterface $output) { - $rebrickableLoader = $this->getContainer()->get('loader.rebrickable'); + $rebrickableLoader = $this->getContainer()->get('service.loader.rebrickable'); $rebrickableLoader->setOutput($output); //TODO log errors diff --git a/src/AppBundle/Entity/Rebrickable/Color.php b/src/AppBundle/Entity/Rebrickable/Color.php index 5db32d0..e5684ed 100644 --- a/src/AppBundle/Entity/Rebrickable/Color.php +++ b/src/AppBundle/Entity/Rebrickable/Color.php @@ -43,7 +43,7 @@ class Color /** * @var Collection * - * @ORM\OneToMany(targetEntity="AppBundle\Entity\Rebrickable\Inventory_part", mappedBy="color") + * @ORM\OneToMany(targetEntity="AppBundle\Entity\Rebrickable\Inventory_Part", mappedBy="color") */ protected $inventoryParts; diff --git a/src/AppBundle/Service/LDViewService.php b/src/AppBundle/Service/LDViewService.php index a5f18fd..1501f70 100644 --- a/src/AppBundle/Service/LDViewService.php +++ b/src/AppBundle/Service/LDViewService.php @@ -16,10 +16,15 @@ class LDViewService private $ldview; /** - * @var \League\Flysystem\Filesystem + * @var Filesystem */ private $mediaFilesystem; + /** + * @var Filesystem + */ + private $ldrawFilesystem; + /** * LDViewService constructor. * @@ -32,6 +37,14 @@ class LDViewService $this->mediaFilesystem = $mediaFilesystem; } + /** + * @param Filesystem $ldrawFilesystem + */ + public function setLdrawFilesystem($ldrawFilesystem) + { + $this->ldrawFilesystem = $ldrawFilesystem; + } + /** * Convert LDraw model from .dat format to .stl by using LDView * stores created file to $stlStorage filesystem. @@ -40,18 +53,18 @@ class LDViewService * * @return File */ - public function datToStl($file, $LDrawDir) + public function datToStl($file, $LDrawDir = null) { - if(!$this->mediaFilesystem->has('ldraw'.DIRECTORY_SEPARATOR.'models')) { - $this->mediaFilesystem->createDir('ldraw' . DIRECTORY_SEPARATOR . 'models'); + if (!$this->mediaFilesystem->has('ldraw'.DIRECTORY_SEPARATOR.'models')) { + $this->mediaFilesystem->createDir('ldraw'.DIRECTORY_SEPARATOR.'models'); } $newFile = 'ldraw'.DIRECTORY_SEPARATOR.'models'.DIRECTORY_SEPARATOR.$file['filename'].'.stl'; if (!$this->mediaFilesystem->has($newFile)) { $this->runLDView([ - $LDrawDir->getAdapter()->getPathPrefix().$file['path'], - '-LDrawDir='.$LDrawDir->getAdapter()->getPathPrefix(), + $this->ldrawFilesystem->getAdapter()->getPathPrefix().$file['path'], + '-LDrawDir='.$this->ldrawFilesystem->getAdapter()->getPathPrefix(), '-ExportFiles=1', '-ExportSuffix=.stl', '-ExportsDir='.$this->mediaFilesystem->getAdapter()->getPathPrefix().'ldraw'.DIRECTORY_SEPARATOR.'models', @@ -74,18 +87,18 @@ class LDViewService * * @return File */ - public function datToPng($file, $LDrawDir) + public function datToPng($file, $LDrawDir = null) { - if(!$this->mediaFilesystem->has('ldraw'.DIRECTORY_SEPARATOR.'images')) { - $this->mediaFilesystem->createDir('ldraw' . DIRECTORY_SEPARATOR . 'images'); + if (!$this->mediaFilesystem->has('ldraw'.DIRECTORY_SEPARATOR.'images')) { + $this->mediaFilesystem->createDir('ldraw'.DIRECTORY_SEPARATOR.'images'); } $newFile = 'ldraw'.DIRECTORY_SEPARATOR.'images'.DIRECTORY_SEPARATOR.$file['filename'].'.png'; if (!$this->mediaFilesystem->has($newFile)) { $this->runLDView([ - $LDrawDir->getAdapter()->getPathPrefix().$file['path'], - '-LDrawDir='.$LDrawDir->getAdapter()->getPathPrefix(), + $this->ldrawFilesystem->getAdapter()->getPathPrefix().$file['path'], + '-LDrawDir='.$this->ldrawFilesystem->getAdapter()->getPathPrefix(), '-AutoCrop=1', '-SaveAlpha=0', '-SnapshotSuffix=.png',