diff --git a/app/AppKernel.php b/app/AppKernel.php index e2f6214..5d30753 100644 --- a/app/AppKernel.php +++ b/app/AppKernel.php @@ -16,6 +16,8 @@ class AppKernel extends Kernel new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), new AppBundle\AppBundle(), + new LoaderBundle\LoaderBundle(), + new FrontBundle\FrontBundle(), new Knp\Bundle\MenuBundle\KnpMenuBundle(), new Oneup\FlysystemBundle\OneupFlysystemBundle(), new Knp\Bundle\PaginatorBundle\KnpPaginatorBundle(), diff --git a/app/Resources/views/part/detail.html.twig b/app/Resources/views/part/detail.html.twig index 469c97c..4bdeaa0 100644 --- a/app/Resources/views/part/detail.html.twig +++ b/app/Resources/views/part/detail.html.twig @@ -43,28 +43,28 @@ {% endif %} - {% if apiPart %} - - {{ 'part.alternates' | trans }} - - {% for alternate in apiPart.alternates %} - {{ alternate }} - {% endfor %} - - - - {{ 'part.molds' | trans }} - - {% for mold in apiPart.molds %} - {{ mold }} - {% endfor %} - - - - - Rebrickable - - {% endif %} + {#{% if apiPart %}#} + {##} + {#{{ 'part.alternates' | trans }}#} + {##} + {#{% for alternate in apiPart.alternates %}#} + {#{{ alternate }}#} + {#{% endfor %}#} + {##} + {##} + {##} + {#{{ 'part.molds' | trans }}#} + {##} + {#{% for mold in apiPart.molds %}#} + {#{{ mold }}#} + {#{% endfor %}#} + {##} + {##} + {##} + {##} + {#Rebrickable#} + {##} + {#{% endif %}#} {% if not part.model %} diff --git a/app/config/routing.yml b/app/config/routing.yml index 28ac584..a71865f 100644 --- a/app/config/routing.yml +++ b/app/config/routing.yml @@ -1,5 +1,5 @@ app: - resource: "@AppBundle/Controller/" + resource: "@FrontBundle/Controller/" type: annotation _liip_imagine: resource: "@LiipImagineBundle/Resources/config/routing.xml" \ No newline at end of file diff --git a/app/config/service/front.yml b/app/config/service/front.yml new file mode 100644 index 0000000..f4219b9 --- /dev/null +++ b/app/config/service/front.yml @@ -0,0 +1,50 @@ +services: + _defaults: + # automatically injects dependencies in your services + autowire: true + # automatically registers your services as commands, event subscribers, etc. + autoconfigure: true + public: false + + + FrontBundle\: + resource: '../../../src/FrontBundle/*' + + + # controllers are imported separately to make sure they're public + # and have a tag that allows actions to type-hint services + FrontBundle\Controller\: + resource: '../../../src/FrontBundle/Controller' + public: true + tags: ['controller.service_arguments'] + + + FrontBundle\Imagine\PartImageLoader: + tags: + - { name: liip_imagine.binary.loader, loader: part_image_loader } + + FrontBundle\Imagine\SetImageLoader: + tags: + - { name: liip_imagine.binary.loader, loader: set_image_loader } + + + # KNP Menu + + menu.builder.main: + class: FrontBundle\Menu\Builder + arguments: ['@knp_menu.factory', '@request_stack'] + public: true + tags: + - { name: knp_menu.menu_builder, method: mainMenu, alias: mainMenu } + + Knp\Menu\FactoryInterface: + alias: knp_menu.factory + + + # Twig + + FrontBundle\Twig\AppExtension: + arguments: + $webDir: "%kernel.root_dir%/../web" + tags: + - { name: twig.extension } diff --git a/app/config/service/legacy_aliases.yml b/app/config/service/legacy_aliases.yml index a8cf278..70c1063 100644 --- a/app/config/service/legacy_aliases.yml +++ b/app/config/service/legacy_aliases.yml @@ -1,29 +1,6 @@ services: -# service.set: '@AppBundle\Service\SetService' -# service.zip: '@AppBundle\Service\ZipService' -# service.model: '@AppBundle\Service\ModelService' -# service.stl.fixer: '@AppBundle\Service\Stl\StlFixerService' -# service.stl.converter: '@AppBundle\Service\Stl\StlConverterService' -# service.stl.renderer: '@AppBundle\Service\Stl\StlRendererService' -# -# app.part_image_loader: '@AppBundle\Imagine\PartImageLoader' -# app.set_image_loader: '@AppBundle\Imagine\SetImageLoader' -# -# app.transformer.format: '@AppBundle\Transformer\FormatTransformer' -# app.relation.mapper: '@AppBundle\Util\RelationMapper' -# - service.loader.base: '@AppBundle\Service\Loader\BaseLoader' - service.loader.rebrickable: '@AppBundle\Service\Loader\RebrickableLoader' - service.loader.model: '@AppBundle\Service\Loader\ModelLoader' - service.loader.relation: '@AppBundle\Service\Loader\RelationLoader' - service.loader.image: '@AppBundle\Service\Loader\ImageLoader' - -# form.search.model: '@AppBundle\Form\Search\ModelSearchType' -# form.search.set: '@AppBundle\Form\Search\SetSearchType' -# -# api.manager.rebrickable: '@AppBundle\Api\Manager\RebrickableManager' -# api.manager.brickset: '@AppBundle\Api\Manager\BricksetManager' -# api.client.rebrickable: '@AppBundle\Api\Client\Rebrickable\RebrickableClient' -# api.client.brickset: '@AppBundle\Api\Client\Brickset\BricksetClient' - -# knp_menu.factory: Knp\Menu\FactoryInterface \ No newline at end of file + service.loader.base: '@LoaderBundle\Service\BaseLoader' + service.loader.rebrickable: '@LoaderBundle\Service\RebrickableLoader' + service.loader.model: '@LoaderBundle\Service\ModelLoader' + service.loader.relation: '@LoaderBundle\Service\RelationLoader' + service.loader.image: '@LoaderBundle\Service\ImageLoader' diff --git a/app/config/service/loader.yml b/app/config/service/loader.yml new file mode 100644 index 0000000..14c6627 --- /dev/null +++ b/app/config/service/loader.yml @@ -0,0 +1,51 @@ +services: + _defaults: + # automatically injects dependencies in your services + autowire: true + # automatically registers your services as commands, event subscribers, etc. + autoconfigure: true + public: false + + + LoaderBundle\: + resource: '../../../src/LoaderBundle/*' + exclude: '../../../src/LoaderBundle/{Exception}' + + LoaderBundle\Service\Stl\StlRendererService: + arguments: + $layout: '%kernel.root_dir%/Resources/povray_layout/layout.tmpl' + $povray: '%povray_bin%' + $stl2pov: '%stl2pov_bin%' + + LoaderBundle\Service\Stl\StlConverterService: + arguments: + $ldview: '%ldview_bin%' + + LoaderBundle\Service\Stl\StlFixerService: + arguments: + $ADMesh: '%admesh_bin%' + + + LoaderBundle\Service\BaseLoader: + abstract: true + + LoaderBundle\Service\ModelLoader: + arguments: + $logger: '@monolog.logger.loader' + + LoaderBundle\Service\RebrickableLoader: + arguments: + $rebrickableDownloadUrl: '%app.rebrickable_downloads_url%' + $logger: '@monolog.logger.loader' + + LoaderBundle\Service\ImageLoader: + arguments: + $rebrickableDownloadUrl: '%app.rebrickable_downloads_url%' + $logger: '@monolog.logger.loader' + + LoaderBundle\Util\RelationMapper: + arguments: + - '@app.relations.cache_provider' + calls: + - [ loadResource, ['%kernel.root_dir%/Resources/relations/part_model.yml', 'part_model']] + - [ loadResource, ['%kernel.root_dir%/Resources/relations/alias_model.yml', 'alias_model']] diff --git a/app/config/service/menu.yml b/app/config/service/menu.yml deleted file mode 100644 index 0baad47..0000000 --- a/app/config/service/menu.yml +++ /dev/null @@ -1 +0,0 @@ -services: diff --git a/app/config/services.yml b/app/config/services.yml index 7238f1b..9987126 100644 --- a/app/config/services.yml +++ b/app/config/services.yml @@ -1,9 +1,9 @@ imports: - { resource: service/legacy_aliases.yml } - - { resource: service/menu.yml } + - { resource: service/front.yml } + - { resource: service/loader.yml } services: - # default configuration for services in *this* file _defaults: # automatically injects dependencies in your services autowire: true @@ -11,66 +11,13 @@ services: autoconfigure: true public: false - # makes classes in src/AppBundle available to be used as services - # this creates a service per class whose id is the fully-qualified class name AppBundle\: resource: '../../src/AppBundle/*' exclude: '../../src/AppBundle/{Entity,Repository,Exception,Api}' - # controllers are imported separately to make sure they're public - # and have a tag that allows actions to type-hint services - AppBundle\Controller\: - resource: '../../src/AppBundle/Controller' - public: true - tags: ['controller.service_arguments'] - app.relations.cache_provider: class: Doctrine\Common\Cache\ArrayCache - # STL - - AppBundle\Service\Stl\StlRendererService: - arguments: - $layout: '%kernel.root_dir%/Resources/povray_layout/layout.tmpl' - $povray: '%povray_bin%' - $stl2pov: '%stl2pov_bin%' - - AppBundle\Service\Stl\StlConverterService: - arguments: - $ldview: '%ldview_bin%' - - AppBundle\Service\Stl\StlFixerService: - arguments: - $ADMesh: '%admesh_bin%' - - # Loaders - - AppBundle\Service\Loader\BaseLoader: - abstract: true - - AppBundle\Service\Loader\ModelLoader: - arguments: - $logger: '@monolog.logger.loader' - - AppBundle\Service\Loader\RebrickableLoader: - arguments: - $rebrickableDownloadUrl: '%app.rebrickable_downloads_url%' - $logger: '@monolog.logger.loader' - - AppBundle\Service\Loader\ImageLoader: - arguments: - $rebrickableDownloadUrl: '%app.rebrickable_downloads_url%' - $logger: '@monolog.logger.loader' - - AppBundle\Util\RelationMapper: - arguments: - - '@app.relations.cache_provider' - calls: - - [ loadResource, ['%kernel.root_dir%/Resources/relations/part_model.yml', 'part_model']] - - [ loadResource, ['%kernel.root_dir%/Resources/relations/alias_model.yml', 'alias_model']] - - # API - app.brickset.cache_provider: class: Doctrine\Common\Cache\PhpFileCache arguments: ["%kernel.cache_dir%/brickset", ".cache.php"] @@ -90,44 +37,12 @@ services: $cache: '@app.brickset.cache_provider' - # Imagine - - AppBundle\Imagine\PartImageLoader: - tags: - - { name: liip_imagine.binary.loader, loader: part_image_loader } - - AppBundle\Imagine\SetImageLoader: - tags: - - { name: liip_imagine.binary.loader, loader: set_image_loader } - - - # KNP Menu - - menu.builder.main: - class: AppBundle\Menu\Builder - arguments: ['@knp_menu.factory', '@request_stack'] - public: true - tags: - - { name: knp_menu.menu_builder, method: mainMenu, alias: mainMenu } - - Knp\Menu\FactoryInterface: - alias: knp_menu.factory - - # Filesystem League\Flysystem\FilesystemInterface: alias: oneup_flysystem.media_filesystem - # Twig - - AppBundle\Twig\AppExtension: - arguments: - $webDir: "%kernel.root_dir%/../web" - tags: - - { name: twig.extension } - # ElasticSearch FOS\ElasticaBundle\Manager\RepositoryManagerInterface: diff --git a/src/AppBundle/Entity/Color.php b/src/AppBundle/Entity/Color.php index 38a5379..0b47789 100644 --- a/src/AppBundle/Entity/Color.php +++ b/src/AppBundle/Entity/Color.php @@ -136,6 +136,7 @@ class Color /** * @param Inventory_Part $inventoryPart + * * @return Color */ public function addPartInventoryPart(Inventory_Part $inventoryPart) diff --git a/src/AppBundle/Repository/LDraw/SubpartRepository.php b/src/AppBundle/Repository/LDraw/SubpartRepository.php index e3b6bc6..c369d20 100644 --- a/src/AppBundle/Repository/LDraw/SubpartRepository.php +++ b/src/AppBundle/Repository/LDraw/SubpartRepository.php @@ -20,6 +20,7 @@ class SubpartRepository extends BaseRepository * @param $child * @param $count * @param $colorId + * * @return Subpart */ public function getOrCreate($parent, $child, $count, $colorId) diff --git a/src/AppBundle/Service/ColorService.php b/src/AppBundle/Service/ColorService.php index 3f713b1..f90d19b 100644 --- a/src/AppBundle/Service/ColorService.php +++ b/src/AppBundle/Service/ColorService.php @@ -13,6 +13,7 @@ class ColorService /** * ColorService constructor. + * * @param EntityManagerInterface $em */ public function __construct(EntityManagerInterface $em) diff --git a/src/AppBundle/Service/ModelService.php b/src/AppBundle/Service/ModelService.php index 01f13c9..511496e 100644 --- a/src/AppBundle/Service/ModelService.php +++ b/src/AppBundle/Service/ModelService.php @@ -30,7 +30,7 @@ class ModelService * * @return Model|null */ - public function findModel($id) + public function find($id) { return $this->modelRepository->findOneByNumber($id); } diff --git a/src/AppBundle/Service/SearchService.php b/src/AppBundle/Service/SearchService.php index 8f36ba4..294f1f9 100644 --- a/src/AppBundle/Service/SearchService.php +++ b/src/AppBundle/Service/SearchService.php @@ -2,7 +2,6 @@ namespace AppBundle\Service; - use AppBundle\Entity\LDraw\Model; use AppBundle\Entity\Rebrickable\Set; use AppBundle\Model\ModelSearch; @@ -22,6 +21,7 @@ class SearchService /** * SearchService constructor. + * * @param RepositoryManagerInterface $repositoryManager */ public function __construct(RepositoryManagerInterface $repositoryManager) @@ -30,70 +30,81 @@ class SearchService $this->setRepository = $repositoryManager->getRepository(Set::class); } - /** - * Find matching sets by query + * Find matching sets by query. * * @param $query * @param int $limit + * * @return array */ - public function searchSetsByQuery($query, $limit = 1000) { + public function searchSetsByQuery($query, $limit = 1000) + { return $this->setRepository->search(new SetSearch($query), $limit); } /** - * Find matching sets by query with highlights + * Find matching sets by query with highlights. * * @param $query * @param int $limit + * * @return HybridResult[] */ - public function searchSetsHighlightedByQuery($query, $limit = 4) { + public function searchSetsHighlightedByQuery($query, $limit = 4) + { return $this->setRepository->findHighlighted($query, $limit); } /** - * Find matching sets by rules in SetSearch class + * Find matching sets by rules in SetSearch class. * * @param SetSearch $setSearch - * @param int $limit + * @param int $limit + * * @return array */ - public function searchSets(SetSearch $setSearch, $limit = 1000) { + public function searchSets(SetSearch $setSearch, $limit = 1000) + { return $this->setRepository->search($setSearch, $limit); } /** - * Find matching models by query + * Find matching models by query. * * @param $query * @param int $limit + * * @return array */ - public function searchModelsByQuery($query, $limit = 1000) { + public function searchModelsByQuery($query, $limit = 1000) + { return $this->modelRepository->search(new ModelSearch($query), $limit); } /** - * Find matching models by query with highlights + * Find matching models by query with highlights. * * @param $query * @param int $limit + * * @return HybridResult[] */ - public function searchModelsHighlightedByQuery($query, $limit = 4) { + public function searchModelsHighlightedByQuery($query, $limit = 4) + { return $this->modelRepository->findHighlighted($query, $limit); } /** - * Find matching models by rules in ModelSearch class + * Find matching models by rules in ModelSearch class. * * @param ModelSearch $modelSearch - * @param int $limit + * @param int $limit + * * @return array */ - public function searchModels(ModelSearch $modelSearch, $limit = 1000) { + public function searchModels(ModelSearch $modelSearch, $limit = 1000) + { return $this->modelRepository->search($modelSearch, $limit); } -} \ No newline at end of file +} diff --git a/src/AppBundle/Service/SetService.php b/src/AppBundle/Service/SetService.php index 9ffe24f..3deda87 100644 --- a/src/AppBundle/Service/SetService.php +++ b/src/AppBundle/Service/SetService.php @@ -36,13 +36,13 @@ class SetService } /** - * Find set by id + * Find set by id. * * @param $id * - * @return Set + * @return object */ - public function findSet($id) + public function find($id) { return $this->setRepository->find($id); } diff --git a/src/AppBundle/Service/ZipService.php b/src/AppBundle/Service/ZipService.php index 063f095..5ac8039 100644 --- a/src/AppBundle/Service/ZipService.php +++ b/src/AppBundle/Service/ZipService.php @@ -30,9 +30,9 @@ class ZipService /** * ZipService constructor. * - * @param FilesystemInterface $mediaFilesystem - * @param ModelService $modelService - * @param SetService $setService + * @param FilesystemInterface $mediaFilesystem + * @param ModelService $modelService + * @param SetService $setService */ public function __construct(FilesystemInterface $mediaFilesystem, ModelService $modelService, SetService $setService) { diff --git a/src/AppBundle/Controller/AjaxController.php b/src/FrontBundle/Controller/AjaxController.php similarity index 93% rename from src/AppBundle/Controller/AjaxController.php rename to src/FrontBundle/Controller/AjaxController.php index 6a56d12..de503c7 100644 --- a/src/AppBundle/Controller/AjaxController.php +++ b/src/FrontBundle/Controller/AjaxController.php @@ -1,6 +1,6 @@ get('knp_paginator'); $models = $paginator->paginate( - $searchService->searchModels($modelSearch,500), + $searchService->searchModels($modelSearch, 500), $request->query->getInt('page', 1)/*page number*/, $request->query->getInt('limit', 30)/*limit per page*/ ); @@ -61,7 +60,7 @@ class ModelController extends Controller */ public function detailAction($id, ModelService $modelService, SetService $setService) { - if ($model = $modelService->findModel($id)) { + if ($model = $modelService->find($id)) { try { return $this->render('model/detail.html.twig', [ 'model' => $model, diff --git a/src/AppBundle/Controller/PartController.php b/src/FrontBundle/Controller/PartController.php similarity index 74% rename from src/AppBundle/Controller/PartController.php rename to src/FrontBundle/Controller/PartController.php index a3149ea..1f2e8f5 100644 --- a/src/AppBundle/Controller/PartController.php +++ b/src/FrontBundle/Controller/PartController.php @@ -1,9 +1,7 @@ getModel()) { $this->redirectToRoute('model_detail', ['id' => $model->getId()]); } - try { - $apiPart = $rebrickableManager->getPart($part->getId()); - } catch (EmptyResponseException $e) { - $this->addFlash('warning', 'Part not found'); - } catch (\Exception $e) { - $this->addFlash('error', $e->getMessage()); - } - return $this->render('part/detail.html.twig', [ 'part' => $part, - 'apiPart' => $apiPart, - 'setCount' => count($setService->getAllByPart($part)) + 'setCount' => count($setService->getAllByPart($part)), ]); } diff --git a/src/AppBundle/Controller/SearchController.php b/src/FrontBundle/Controller/SearchController.php similarity index 92% rename from src/AppBundle/Controller/SearchController.php rename to src/FrontBundle/Controller/SearchController.php index d9474f6..659ce77 100644 --- a/src/AppBundle/Controller/SearchController.php +++ b/src/FrontBundle/Controller/SearchController.php @@ -1,13 +1,7 @@ getApplication()->find('app:load:images'); $returnCode = $loadImagesCommand->run(new ArrayInput([ 'command' => 'app:load:images', diff --git a/src/AppBundle/Command/LoadImagesCommand.php b/src/LoaderBundle/Command/LoadImagesCommand.php similarity index 96% rename from src/AppBundle/Command/LoadImagesCommand.php rename to src/LoaderBundle/Command/LoadImagesCommand.php index c801685..76efd3e 100644 --- a/src/AppBundle/Command/LoadImagesCommand.php +++ b/src/LoaderBundle/Command/LoadImagesCommand.php @@ -1,8 +1,8 @@ output->writeln([ - "Rendering missing images of models", + 'Rendering missing images of models', ]); $this->initProgressBar(count($missing)); foreach ($missing as $model) { @@ -88,7 +88,7 @@ class ImageLoader extends BaseLoader } /** - * Render model and save image into + * Render model and save image into. * * @param $file */ diff --git a/src/AppBundle/Service/Loader/ModelLoader.php b/src/LoaderBundle/Service/ModelLoader.php similarity index 96% rename from src/AppBundle/Service/Loader/ModelLoader.php rename to src/LoaderBundle/Service/ModelLoader.php index 8740e55..9555e25 100644 --- a/src/AppBundle/Service/Loader/ModelLoader.php +++ b/src/LoaderBundle/Service/ModelLoader.php @@ -1,6 +1,6 @@ writeOutput(['LDraw libary downloaded']); // return ldraw directory if in zip file - if(file_exists($temp_dir.'/ldraw/')) { + if (file_exists($temp_dir.'/ldraw/')) { return $temp_dir.'/ldraw/'; } @@ -183,7 +184,7 @@ class ModelLoader extends BaseLoader $this->loadModel($this->ldrawLibraryContext->getAdapter()->getPathPrefix().$file['path']); // clear managed objects to avoid memory issues - if($index++ % 50 == 0) { + if ($index++ % 50 == 0) { $this->em->clear(); } $connection->commit(); @@ -215,7 +216,7 @@ class ModelLoader extends BaseLoader // Return model from database if rewrite is not enabled if (!$this->rewrite && $model = $modelRepository->find(basename($file, '.dat'))) { - /** @var Model $model */ + /* @var Model $model */ return $model; } diff --git a/src/AppBundle/Service/Loader/RebrickableLoader.php b/src/LoaderBundle/Service/RebrickableLoader.php similarity index 87% rename from src/AppBundle/Service/Loader/RebrickableLoader.php rename to src/LoaderBundle/Service/RebrickableLoader.php index b97ad37..973aaf9 100644 --- a/src/AppBundle/Service/Loader/RebrickableLoader.php +++ b/src/LoaderBundle/Service/RebrickableLoader.php @@ -1,6 +1,6 @@ em->getConnection(); @@ -62,11 +67,16 @@ class RebrickableLoader extends BaseLoader $this->writeOutput(['Rebrickable database loaded successfully!']); } catch (\Exception $e) { + $this->writeOutput(['Rollback back']); $connection->rollBack(); throw $e; } } + + /** + * Downloads csv files from rebrickable_url specified in config.yml + */ private function loadCSVFiles() { $array = ['inventories', 'inventory_parts', 'inventory_sets', 'sets', 'themes', 'parts', 'part_categories', 'colors']; @@ -84,21 +94,33 @@ class RebrickableLoader extends BaseLoader $this->writeOutput(['All CSV files loaded.']); } + /** + * Truncate content of rebrickable tables. + * + * @return bool + */ private function truncateTables() { $query = ' - TRUNCATE TABLE rebrickable_inventory_parts; - TRUNCATE TABLE rebrickable_inventory_sets; - TRUNCATE TABLE rebrickable_inventory; - TRUNCATE TABLE rebrickable_set; - TRUNCATE TABLE rebrickable_theme; - TRUNCATE TABLE rebrickable_part; - TRUNCATE TABLE rebrickable_category; + DELETE FROM rebrickable_inventory_parts; + DELETE FROM rebrickable_inventory_sets; + DELETE FROM rebrickable_inventory; + DELETE FROM rebrickable_set; + DELETE FROM rebrickable_theme; + DELETE FROM rebrickable_part; + DELETE FROM rebrickable_category; '; return $this->em->getConnection()->prepare($query)->execute(); } + /** + * @param $file + * @param $table + * @param $columns + * + * @return bool + */ private function loadCsvFile($file, $table, $columns) { $query = sprintf("LOAD DATA LOCAL INFILE '%s' diff --git a/src/AppBundle/Service/Loader/RelationLoader.php b/src/LoaderBundle/Service/RelationLoader.php similarity index 98% rename from src/AppBundle/Service/Loader/RelationLoader.php rename to src/LoaderBundle/Service/RelationLoader.php index 0828e82..d46262b 100644 --- a/src/AppBundle/Service/Loader/RelationLoader.php +++ b/src/LoaderBundle/Service/RelationLoader.php @@ -1,13 +1,13 @@ modelRepository->findOneByName($part->getName()); } } + return $model; } diff --git a/src/AppBundle/Service/Stl/StlConverterService.php b/src/LoaderBundle/Service/Stl/StlConverterService.php similarity index 97% rename from src/AppBundle/Service/Stl/StlConverterService.php rename to src/LoaderBundle/Service/Stl/StlConverterService.php index db51c8d..f9c5dcb 100644 --- a/src/AppBundle/Service/Stl/StlConverterService.php +++ b/src/LoaderBundle/Service/Stl/StlConverterService.php @@ -1,12 +1,12 @@ cache = $cache; } - /** * Adds a Resource. * @@ -43,7 +43,7 @@ class RelationMapper try { if (!$data = unserialize($this->cache->fetch($domain))) { - $data = Yaml::parse(file_get_contents($file),yaml::PARSE_KEYS_AS_STRINGS); + $data = Yaml::parse(file_get_contents($file), yaml::PARSE_KEYS_AS_STRINGS); $this->cache->save($domain, serialize($data), 60); } diff --git a/tests/AppBundle/Fixtures/LoadBaseData.php b/tests/AppBundle/Fixtures/LoadBaseData.php index d1a92ba..a9c373b 100644 --- a/tests/AppBundle/Fixtures/LoadBaseData.php +++ b/tests/AppBundle/Fixtures/LoadBaseData.php @@ -2,7 +2,6 @@ namespace Tests\AppBundle\Fixtures; - use AppBundle\Entity\Color; use AppBundle\Entity\LDraw\Author; use AppBundle\Entity\LDraw\Model; diff --git a/tests/AppBundle/Service/ZipServiceTest.php b/tests/AppBundle/Service/ZipServiceTest.php index e4d670c..bf52773 100644 --- a/tests/AppBundle/Service/ZipServiceTest.php +++ b/tests/AppBundle/Service/ZipServiceTest.php @@ -30,7 +30,7 @@ class ZipServiceTest extends BaseTest $this->modelService = $this->get(ModelService::class); $this->setService = $this->get(SetService::class); - $this->filesystem->write('models/1.stl',file_get_contents(__DIR__.'/../Fixtures/models/1.stl')); + $this->filesystem->write('models/1.stl',file_get_contents(__DIR__ . '/../Fixtures/models/1.stl')); $this->zipService = new ZipService($this->filesystem,$this->modelService,$this->setService); } @@ -42,7 +42,7 @@ class ZipServiceTest extends BaseTest public function testModelZip() { - $model = $this->modelService->findModel(1); + $model = $this->modelService->find(1); $path = $this->zipService->createFromModel($model, 'modelzip'); @@ -51,7 +51,7 @@ class ZipServiceTest extends BaseTest public function testSetZip() { - $set = $this->setService->findSet('8049-1'); + $set = $this->setService->find('8049-1'); $path = $this->zipService->createFromSet($set, 'setzip'); diff --git a/tests/AppBundle/Controller/ApplicationAvailabilityTest.php b/tests/FrontBundle/Controller/ApplicationAvailabilityTest.php similarity index 90% rename from tests/AppBundle/Controller/ApplicationAvailabilityTest.php rename to tests/FrontBundle/Controller/ApplicationAvailabilityTest.php index bab4d08..3736085 100644 --- a/tests/AppBundle/Controller/ApplicationAvailabilityTest.php +++ b/tests/FrontBundle/Controller/ApplicationAvailabilityTest.php @@ -1,8 +1,8 @@