mirror of
https://github.com/ToxicCrack/PrintABrick.git
synced 2025-05-16 20:30:09 -07:00
Refactor code into bundles
This commit is contained in:
parent
ba979c50c7
commit
3e8da890c4
@ -16,6 +16,8 @@ class AppKernel extends Kernel
|
|||||||
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
|
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
|
||||||
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
|
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
|
||||||
new AppBundle\AppBundle(),
|
new AppBundle\AppBundle(),
|
||||||
|
new LoaderBundle\LoaderBundle(),
|
||||||
|
new FrontBundle\FrontBundle(),
|
||||||
new Knp\Bundle\MenuBundle\KnpMenuBundle(),
|
new Knp\Bundle\MenuBundle\KnpMenuBundle(),
|
||||||
new Oneup\FlysystemBundle\OneupFlysystemBundle(),
|
new Oneup\FlysystemBundle\OneupFlysystemBundle(),
|
||||||
new Knp\Bundle\PaginatorBundle\KnpPaginatorBundle(),
|
new Knp\Bundle\PaginatorBundle\KnpPaginatorBundle(),
|
||||||
|
@ -43,28 +43,28 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% if apiPart %}
|
{#{% if apiPart %}#}
|
||||||
<tr>
|
{#<tr>#}
|
||||||
<td>{{ 'part.alternates' | trans }}</td>
|
{#<td>{{ 'part.alternates' | trans }}</td>#}
|
||||||
<td>
|
{#<td>#}
|
||||||
{% for alternate in apiPart.alternates %}
|
{#{% for alternate in apiPart.alternates %}#}
|
||||||
<a href="{{ url('part_detail', {'id': alternate})}}">{{ alternate }}</a>
|
{#<a href="{{ url('part_detail', {'id': alternate})}}">{{ alternate }}</a>#}
|
||||||
{% endfor %}
|
{#{% endfor %}#}
|
||||||
</td>
|
{#</td>#}
|
||||||
</tr>
|
{#</tr>#}
|
||||||
<tr>
|
{#<tr>#}
|
||||||
<td>{{ 'part.molds' | trans }}</td>
|
{#<td>{{ 'part.molds' | trans }}</td>#}
|
||||||
<td>
|
{#<td>#}
|
||||||
{% for mold in apiPart.molds %}
|
{#{% for mold in apiPart.molds %}#}
|
||||||
<a href="{{ url('part_detail', {'id': mold})}}">{{ mold }}</a>
|
{#<a href="{{ url('part_detail', {'id': mold})}}">{{ mold }}</a>#}
|
||||||
{% endfor %}
|
{#{% endfor %}#}
|
||||||
</td>
|
{#</td>#}
|
||||||
</tr>
|
{#</tr>#}
|
||||||
<tr>
|
{#<tr>#}
|
||||||
<td></td>
|
{#<td></td>#}
|
||||||
<td><a class="rebrickable link" href="{{ apiPart.url }}">Rebrickable</a></td>
|
{#<td><a class="rebrickable link" href="{{ apiPart.url }}">Rebrickable</a></td>#}
|
||||||
</tr>
|
{#</tr>#}
|
||||||
{% endif %}
|
{#{% endif %}#}
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
{% if not part.model %}
|
{% if not part.model %}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
app:
|
app:
|
||||||
resource: "@AppBundle/Controller/"
|
resource: "@FrontBundle/Controller/"
|
||||||
type: annotation
|
type: annotation
|
||||||
_liip_imagine:
|
_liip_imagine:
|
||||||
resource: "@LiipImagineBundle/Resources/config/routing.xml"
|
resource: "@LiipImagineBundle/Resources/config/routing.xml"
|
50
app/config/service/front.yml
Normal file
50
app/config/service/front.yml
Normal file
@ -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 }
|
@ -1,29 +1,6 @@
|
|||||||
services:
|
services:
|
||||||
# service.set: '@AppBundle\Service\SetService'
|
service.loader.base: '@LoaderBundle\Service\BaseLoader'
|
||||||
# service.zip: '@AppBundle\Service\ZipService'
|
service.loader.rebrickable: '@LoaderBundle\Service\RebrickableLoader'
|
||||||
# service.model: '@AppBundle\Service\ModelService'
|
service.loader.model: '@LoaderBundle\Service\ModelLoader'
|
||||||
# service.stl.fixer: '@AppBundle\Service\Stl\StlFixerService'
|
service.loader.relation: '@LoaderBundle\Service\RelationLoader'
|
||||||
# service.stl.converter: '@AppBundle\Service\Stl\StlConverterService'
|
service.loader.image: '@LoaderBundle\Service\ImageLoader'
|
||||||
# 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
|
|
||||||
|
51
app/config/service/loader.yml
Normal file
51
app/config/service/loader.yml
Normal file
@ -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']]
|
@ -1 +0,0 @@
|
|||||||
services:
|
|
@ -1,9 +1,9 @@
|
|||||||
imports:
|
imports:
|
||||||
- { resource: service/legacy_aliases.yml }
|
- { resource: service/legacy_aliases.yml }
|
||||||
- { resource: service/menu.yml }
|
- { resource: service/front.yml }
|
||||||
|
- { resource: service/loader.yml }
|
||||||
|
|
||||||
services:
|
services:
|
||||||
# default configuration for services in *this* file
|
|
||||||
_defaults:
|
_defaults:
|
||||||
# automatically injects dependencies in your services
|
# automatically injects dependencies in your services
|
||||||
autowire: true
|
autowire: true
|
||||||
@ -11,66 +11,13 @@ services:
|
|||||||
autoconfigure: true
|
autoconfigure: true
|
||||||
public: false
|
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\:
|
AppBundle\:
|
||||||
resource: '../../src/AppBundle/*'
|
resource: '../../src/AppBundle/*'
|
||||||
exclude: '../../src/AppBundle/{Entity,Repository,Exception,Api}'
|
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:
|
app.relations.cache_provider:
|
||||||
class: Doctrine\Common\Cache\ArrayCache
|
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:
|
app.brickset.cache_provider:
|
||||||
class: Doctrine\Common\Cache\PhpFileCache
|
class: Doctrine\Common\Cache\PhpFileCache
|
||||||
arguments: ["%kernel.cache_dir%/brickset", ".cache.php"]
|
arguments: ["%kernel.cache_dir%/brickset", ".cache.php"]
|
||||||
@ -90,44 +37,12 @@ services:
|
|||||||
$cache: '@app.brickset.cache_provider'
|
$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
|
# Filesystem
|
||||||
|
|
||||||
League\Flysystem\FilesystemInterface:
|
League\Flysystem\FilesystemInterface:
|
||||||
alias: oneup_flysystem.media_filesystem
|
alias: oneup_flysystem.media_filesystem
|
||||||
|
|
||||||
|
|
||||||
# Twig
|
|
||||||
|
|
||||||
AppBundle\Twig\AppExtension:
|
|
||||||
arguments:
|
|
||||||
$webDir: "%kernel.root_dir%/../web"
|
|
||||||
tags:
|
|
||||||
- { name: twig.extension }
|
|
||||||
|
|
||||||
# ElasticSearch
|
# ElasticSearch
|
||||||
|
|
||||||
FOS\ElasticaBundle\Manager\RepositoryManagerInterface:
|
FOS\ElasticaBundle\Manager\RepositoryManagerInterface:
|
||||||
|
@ -136,6 +136,7 @@ class Color
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Inventory_Part $inventoryPart
|
* @param Inventory_Part $inventoryPart
|
||||||
|
*
|
||||||
* @return Color
|
* @return Color
|
||||||
*/
|
*/
|
||||||
public function addPartInventoryPart(Inventory_Part $inventoryPart)
|
public function addPartInventoryPart(Inventory_Part $inventoryPart)
|
||||||
|
@ -20,6 +20,7 @@ class SubpartRepository extends BaseRepository
|
|||||||
* @param $child
|
* @param $child
|
||||||
* @param $count
|
* @param $count
|
||||||
* @param $colorId
|
* @param $colorId
|
||||||
|
*
|
||||||
* @return Subpart
|
* @return Subpart
|
||||||
*/
|
*/
|
||||||
public function getOrCreate($parent, $child, $count, $colorId)
|
public function getOrCreate($parent, $child, $count, $colorId)
|
||||||
|
@ -13,6 +13,7 @@ class ColorService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* ColorService constructor.
|
* ColorService constructor.
|
||||||
|
*
|
||||||
* @param EntityManagerInterface $em
|
* @param EntityManagerInterface $em
|
||||||
*/
|
*/
|
||||||
public function __construct(EntityManagerInterface $em)
|
public function __construct(EntityManagerInterface $em)
|
||||||
|
@ -30,7 +30,7 @@ class ModelService
|
|||||||
*
|
*
|
||||||
* @return Model|null
|
* @return Model|null
|
||||||
*/
|
*/
|
||||||
public function findModel($id)
|
public function find($id)
|
||||||
{
|
{
|
||||||
return $this->modelRepository->findOneByNumber($id);
|
return $this->modelRepository->findOneByNumber($id);
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace AppBundle\Service;
|
namespace AppBundle\Service;
|
||||||
|
|
||||||
|
|
||||||
use AppBundle\Entity\LDraw\Model;
|
use AppBundle\Entity\LDraw\Model;
|
||||||
use AppBundle\Entity\Rebrickable\Set;
|
use AppBundle\Entity\Rebrickable\Set;
|
||||||
use AppBundle\Model\ModelSearch;
|
use AppBundle\Model\ModelSearch;
|
||||||
@ -22,6 +21,7 @@ class SearchService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* SearchService constructor.
|
* SearchService constructor.
|
||||||
|
*
|
||||||
* @param RepositoryManagerInterface $repositoryManager
|
* @param RepositoryManagerInterface $repositoryManager
|
||||||
*/
|
*/
|
||||||
public function __construct(RepositoryManagerInterface $repositoryManager)
|
public function __construct(RepositoryManagerInterface $repositoryManager)
|
||||||
@ -30,70 +30,81 @@ class SearchService
|
|||||||
$this->setRepository = $repositoryManager->getRepository(Set::class);
|
$this->setRepository = $repositoryManager->getRepository(Set::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find matching sets by query
|
* Find matching sets by query.
|
||||||
*
|
*
|
||||||
* @param $query
|
* @param $query
|
||||||
* @param int $limit
|
* @param int $limit
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function searchSetsByQuery($query, $limit = 1000) {
|
public function searchSetsByQuery($query, $limit = 1000)
|
||||||
|
{
|
||||||
return $this->setRepository->search(new SetSearch($query), $limit);
|
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 $query
|
||||||
* @param int $limit
|
* @param int $limit
|
||||||
|
*
|
||||||
* @return HybridResult[]
|
* @return HybridResult[]
|
||||||
*/
|
*/
|
||||||
public function searchSetsHighlightedByQuery($query, $limit = 4) {
|
public function searchSetsHighlightedByQuery($query, $limit = 4)
|
||||||
|
{
|
||||||
return $this->setRepository->findHighlighted($query, $limit);
|
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 SetSearch $setSearch
|
||||||
* @param int $limit
|
* @param int $limit
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function searchSets(SetSearch $setSearch, $limit = 1000) {
|
public function searchSets(SetSearch $setSearch, $limit = 1000)
|
||||||
|
{
|
||||||
return $this->setRepository->search($setSearch, $limit);
|
return $this->setRepository->search($setSearch, $limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find matching models by query
|
* Find matching models by query.
|
||||||
*
|
*
|
||||||
* @param $query
|
* @param $query
|
||||||
* @param int $limit
|
* @param int $limit
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function searchModelsByQuery($query, $limit = 1000) {
|
public function searchModelsByQuery($query, $limit = 1000)
|
||||||
|
{
|
||||||
return $this->modelRepository->search(new ModelSearch($query), $limit);
|
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 $query
|
||||||
* @param int $limit
|
* @param int $limit
|
||||||
|
*
|
||||||
* @return HybridResult[]
|
* @return HybridResult[]
|
||||||
*/
|
*/
|
||||||
public function searchModelsHighlightedByQuery($query, $limit = 4) {
|
public function searchModelsHighlightedByQuery($query, $limit = 4)
|
||||||
|
{
|
||||||
return $this->modelRepository->findHighlighted($query, $limit);
|
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 ModelSearch $modelSearch
|
||||||
* @param int $limit
|
* @param int $limit
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function searchModels(ModelSearch $modelSearch, $limit = 1000) {
|
public function searchModels(ModelSearch $modelSearch, $limit = 1000)
|
||||||
|
{
|
||||||
return $this->modelRepository->search($modelSearch, $limit);
|
return $this->modelRepository->search($modelSearch, $limit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,13 +36,13 @@ class SetService
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find set by id
|
* Find set by id.
|
||||||
*
|
*
|
||||||
* @param $id
|
* @param $id
|
||||||
*
|
*
|
||||||
* @return Set
|
* @return object
|
||||||
*/
|
*/
|
||||||
public function findSet($id)
|
public function find($id)
|
||||||
{
|
{
|
||||||
return $this->setRepository->find($id);
|
return $this->setRepository->find($id);
|
||||||
}
|
}
|
||||||
|
@ -30,9 +30,9 @@ class ZipService
|
|||||||
/**
|
/**
|
||||||
* ZipService constructor.
|
* ZipService constructor.
|
||||||
*
|
*
|
||||||
* @param FilesystemInterface $mediaFilesystem
|
* @param FilesystemInterface $mediaFilesystem
|
||||||
* @param ModelService $modelService
|
* @param ModelService $modelService
|
||||||
* @param SetService $setService
|
* @param SetService $setService
|
||||||
*/
|
*/
|
||||||
public function __construct(FilesystemInterface $mediaFilesystem, ModelService $modelService, SetService $setService)
|
public function __construct(FilesystemInterface $mediaFilesystem, ModelService $modelService, SetService $setService)
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace AppBundle\Controller;
|
namespace FrontBundle\Controller;
|
||||||
|
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
@ -11,8 +11,10 @@ class AjaxController extends AbstractController
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @Route("/set_tab/{tab}", name="set_tab", requirements={"tab"=".+"})
|
* @Route("/set_tab/{tab}", name="set_tab", requirements={"tab"=".+"})
|
||||||
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @param $tab
|
* @param $tab
|
||||||
|
*
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function setDefaultTabAction(Request $request, $tab)
|
public function setDefaultTabAction(Request $request, $tab)
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace AppBundle\Controller\Brickset;
|
namespace FrontBundle\Controller\Brickset;
|
||||||
|
|
||||||
use AppBundle\Api\Exception\ApiException;
|
use AppBundle\Api\Exception\ApiException;
|
||||||
use AppBundle\Api\Manager\BricksetManager;
|
use AppBundle\Api\Manager\BricksetManager;
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace AppBundle\Controller;
|
namespace FrontBundle\Controller;
|
||||||
|
|
||||||
use AppBundle\Entity\Color;
|
use AppBundle\Entity\Color;
|
||||||
use AppBundle\Service\ColorService;
|
use AppBundle\Service\ColorService;
|
||||||
@ -17,7 +17,9 @@ class ColorController extends AbstractController
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @Route("/", name="color_index")
|
* @Route("/", name="color_index")
|
||||||
|
*
|
||||||
* @param ColorService $colorService
|
* @param ColorService $colorService
|
||||||
|
*
|
||||||
* @return \Symfony\Component\HttpFoundation\Response
|
* @return \Symfony\Component\HttpFoundation\Response
|
||||||
*/
|
*/
|
||||||
public function indexAction(ColorService $colorService)
|
public function indexAction(ColorService $colorService)
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace AppBundle\Controller;
|
namespace FrontBundle\Controller;
|
||||||
|
|
||||||
use AppBundle\Service\ModelService;
|
use AppBundle\Service\ModelService;
|
||||||
use AppBundle\Service\SetService;
|
use AppBundle\Service\SetService;
|
@ -1,8 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace AppBundle\Controller;
|
namespace FrontBundle\Controller;
|
||||||
|
|
||||||
use League\Flysystem\Filesystem;
|
|
||||||
use League\Flysystem\FilesystemInterface;
|
use League\Flysystem\FilesystemInterface;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||||
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
@ -1,15 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace AppBundle\Controller;
|
namespace FrontBundle\Controller;
|
||||||
|
|
||||||
use AppBundle\Entity\LDraw\Model;
|
use AppBundle\Entity\LDraw\Model;
|
||||||
use AppBundle\Form\Search\ModelSearchType;
|
|
||||||
use AppBundle\Model\ModelSearch;
|
use AppBundle\Model\ModelSearch;
|
||||||
use AppBundle\Model\SetSearch;
|
|
||||||
use AppBundle\Service\ModelService;
|
use AppBundle\Service\ModelService;
|
||||||
use AppBundle\Service\SearchService;
|
use AppBundle\Service\SearchService;
|
||||||
use AppBundle\Service\SetService;
|
use AppBundle\Service\SetService;
|
||||||
use AppBundle\Service\ZipService;
|
use AppBundle\Service\ZipService;
|
||||||
|
use FrontBundle\Form\Search\ModelSearchType;
|
||||||
use Knp\Component\Pager\Paginator;
|
use Knp\Component\Pager\Paginator;
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||||
@ -42,7 +41,7 @@ class ModelController extends Controller
|
|||||||
/** @var Paginator $paginator */
|
/** @var Paginator $paginator */
|
||||||
$paginator = $this->get('knp_paginator');
|
$paginator = $this->get('knp_paginator');
|
||||||
$models = $paginator->paginate(
|
$models = $paginator->paginate(
|
||||||
$searchService->searchModels($modelSearch,500),
|
$searchService->searchModels($modelSearch, 500),
|
||||||
$request->query->getInt('page', 1)/*page number*/,
|
$request->query->getInt('page', 1)/*page number*/,
|
||||||
$request->query->getInt('limit', 30)/*limit per page*/
|
$request->query->getInt('limit', 30)/*limit per page*/
|
||||||
);
|
);
|
||||||
@ -61,7 +60,7 @@ class ModelController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function detailAction($id, ModelService $modelService, SetService $setService)
|
public function detailAction($id, ModelService $modelService, SetService $setService)
|
||||||
{
|
{
|
||||||
if ($model = $modelService->findModel($id)) {
|
if ($model = $modelService->find($id)) {
|
||||||
try {
|
try {
|
||||||
return $this->render('model/detail.html.twig', [
|
return $this->render('model/detail.html.twig', [
|
||||||
'model' => $model,
|
'model' => $model,
|
@ -1,9 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace AppBundle\Controller;
|
namespace FrontBundle\Controller;
|
||||||
|
|
||||||
use AppBundle\Api\Exception\EmptyResponseException;
|
|
||||||
use AppBundle\Api\Manager\RebrickableManager;
|
|
||||||
use AppBundle\Entity\Rebrickable\Part;
|
use AppBundle\Entity\Rebrickable\Part;
|
||||||
use AppBundle\Service\SetService;
|
use AppBundle\Service\SetService;
|
||||||
use Knp\Component\Pager\Paginator;
|
use Knp\Component\Pager\Paginator;
|
||||||
@ -24,26 +22,16 @@ class PartController extends Controller
|
|||||||
*
|
*
|
||||||
* @Route("/{id}", name="part_detail")
|
* @Route("/{id}", name="part_detail")
|
||||||
*/
|
*/
|
||||||
public function detailAction(Part $part, RebrickableManager $rebrickableManager, SetService $setService)
|
public function detailAction(Part $part, SetService $setService)
|
||||||
{
|
{
|
||||||
$apiPart = null;
|
|
||||||
if ($part) {
|
if ($part) {
|
||||||
if ($model = $part->getModel()) {
|
if ($model = $part->getModel()) {
|
||||||
$this->redirectToRoute('model_detail', ['id' => $model->getId()]);
|
$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', [
|
return $this->render('part/detail.html.twig', [
|
||||||
'part' => $part,
|
'part' => $part,
|
||||||
'apiPart' => $apiPart,
|
'setCount' => count($setService->getAllByPart($part)),
|
||||||
'setCount' => count($setService->getAllByPart($part))
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
@ -1,13 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace AppBundle\Controller;
|
namespace FrontBundle\Controller;
|
||||||
|
|
||||||
use AppBundle\Entity\LDraw\Model;
|
|
||||||
use AppBundle\Entity\Rebrickable\Set;
|
|
||||||
use AppBundle\Model\ModelSearch;
|
|
||||||
use AppBundle\Model\SetSearch;
|
|
||||||
use AppBundle\Repository\Search\ModelRepository;
|
|
||||||
use AppBundle\Repository\Search\SetRepository;
|
|
||||||
use AppBundle\Service\SearchService;
|
use AppBundle\Service\SearchService;
|
||||||
use FOS\ElasticaBundle\HybridResult;
|
use FOS\ElasticaBundle\HybridResult;
|
||||||
use Liip\ImagineBundle\Imagine\Cache\CacheManager;
|
use Liip\ImagineBundle\Imagine\Cache\CacheManager;
|
@ -1,16 +1,16 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace AppBundle\Controller;
|
namespace FrontBundle\Controller;
|
||||||
|
|
||||||
use AppBundle\Api\Exception\ApiException;
|
use AppBundle\Api\Exception\ApiException;
|
||||||
use AppBundle\Api\Manager\BricksetManager;
|
use AppBundle\Api\Manager\BricksetManager;
|
||||||
use AppBundle\Entity\Rebrickable\Set;
|
use AppBundle\Entity\Rebrickable\Set;
|
||||||
use AppBundle\Form\Search\SetSearchType;
|
|
||||||
use AppBundle\Model\SetSearch;
|
use AppBundle\Model\SetSearch;
|
||||||
use AppBundle\Repository\Search\SetRepository;
|
|
||||||
use AppBundle\Service\SearchService;
|
use AppBundle\Service\SearchService;
|
||||||
use AppBundle\Service\SetService;
|
use AppBundle\Service\SetService;
|
||||||
use AppBundle\Service\ZipService;
|
use AppBundle\Service\ZipService;
|
||||||
|
use Elastica\Index;
|
||||||
|
use FrontBundle\Form\Search\SetSearchType;
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||||
use Symfony\Component\Form\FormFactoryInterface;
|
use Symfony\Component\Form\FormFactoryInterface;
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace AppBundle\Form;
|
namespace FrontBundle\Form;
|
||||||
|
|
||||||
use AppBundle\Model\NumberRange;
|
use AppBundle\Model\NumberRange;
|
||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace AppBundle\Form\Search;
|
namespace FrontBundle\Form\Search;
|
||||||
|
|
||||||
use AppBundle\Entity\LDraw\Category;
|
use AppBundle\Entity\LDraw\Category;
|
||||||
use AppBundle\Model\ModelSearch;
|
use AppBundle\Model\ModelSearch;
|
@ -1,14 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace AppBundle\Form\Search;
|
namespace FrontBundle\Form\Search;
|
||||||
|
|
||||||
use AppBundle\Entity\Rebrickable\Set;
|
use AppBundle\Entity\Rebrickable\Set;
|
||||||
use AppBundle\Entity\Rebrickable\Theme;
|
use AppBundle\Entity\Rebrickable\Theme;
|
||||||
use AppBundle\Form\NumberRangeType;
|
|
||||||
use AppBundle\Model\SetSearch;
|
use AppBundle\Model\SetSearch;
|
||||||
use AppBundle\Repository\Rebrickable\SetRepository;
|
use AppBundle\Repository\Rebrickable\SetRepository;
|
||||||
use AppBundle\Repository\Rebrickable\ThemeRepository;
|
use AppBundle\Repository\Rebrickable\ThemeRepository;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use FrontBundle\Form\NumberRangeType;
|
||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
9
src/FrontBundle/FrontBundle.php
Normal file
9
src/FrontBundle/FrontBundle.php
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace FrontBundle;
|
||||||
|
|
||||||
|
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
||||||
|
|
||||||
|
class FrontBundle extends Bundle
|
||||||
|
{
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace AppBundle\Imagine;
|
namespace FrontBundle\Imagine;
|
||||||
|
|
||||||
use Liip\ImagineBundle\Binary\Loader\LoaderInterface;
|
use Liip\ImagineBundle\Binary\Loader\LoaderInterface;
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace AppBundle\Imagine;
|
namespace FrontBundle\Imagine;
|
||||||
|
|
||||||
use AppBundle\Api\Manager\RebrickableManager;
|
use AppBundle\Api\Manager\RebrickableManager;
|
||||||
use League\Flysystem\Filesystem;
|
use League\Flysystem\Filesystem;
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace AppBundle\Imagine;
|
namespace FrontBundle\Imagine;
|
||||||
|
|
||||||
use AppBundle\Api\Manager\BricksetManager;
|
use AppBundle\Api\Manager\BricksetManager;
|
||||||
use League\Flysystem\Filesystem;
|
use League\Flysystem\Filesystem;
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace AppBundle\Menu;
|
namespace FrontBundle\Menu;
|
||||||
|
|
||||||
use Knp\Menu\FactoryInterface;
|
use Knp\Menu\FactoryInterface;
|
||||||
use Symfony\Component\HttpFoundation\RequestStack;
|
use Symfony\Component\HttpFoundation\RequestStack;
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace AppBundle\Twig;
|
namespace FrontBundle\Twig;
|
||||||
|
|
||||||
use AppBundle\Transformer\FormatTransformer;
|
use AppBundle\Transformer\FormatTransformer;
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace AppBundle\Command;
|
namespace LoaderBundle\Command;
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
|
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
|
||||||
use Symfony\Component\Console\Input\ArrayInput;
|
use Symfony\Component\Console\Input\ArrayInput;
|
||||||
@ -54,7 +54,7 @@ class InitDataCommand extends ContainerAwareCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load images
|
// Load images
|
||||||
|
|
||||||
$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',
|
@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace AppBundle\Command;
|
namespace LoaderBundle\Command;
|
||||||
|
|
||||||
use AppBundle\Service\Loader\ImageLoader;
|
use LoaderBundle\Service\ImageLoader;
|
||||||
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
|
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
|
||||||
use Symfony\Component\Console\Input\InputDefinition;
|
use Symfony\Component\Console\Input\InputDefinition;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace AppBundle\Command;
|
namespace LoaderBundle\Command;
|
||||||
|
|
||||||
use AppBundle\Service\Loader\ModelLoader;
|
use LoaderBundle\Service\ModelLoader;
|
||||||
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
|
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
|
||||||
use Symfony\Component\Console\Command\LockableTrait;
|
use Symfony\Component\Console\Command\LockableTrait;
|
||||||
use Symfony\Component\Console\Input\InputDefinition;
|
use Symfony\Component\Console\Input\InputDefinition;
|
@ -1,9 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace AppBundle\Command;
|
namespace LoaderBundle\Command;
|
||||||
|
|
||||||
use AppBundle\Service\Loader\RebrickableLoader;
|
|
||||||
use League\Flysystem\Exception;
|
use League\Flysystem\Exception;
|
||||||
|
use LoaderBundle\Service\RebrickableLoader;
|
||||||
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
|
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
|
||||||
use Symfony\Component\Console\Input\ArrayInput;
|
use Symfony\Component\Console\Input\ArrayInput;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace AppBundle\Command;
|
namespace LoaderBundle\Command;
|
||||||
|
|
||||||
use AppBundle\Service\Loader\RelationLoader;
|
use LoaderBundle\Service\RelationLoader;
|
||||||
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
|
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
|
||||||
use Symfony\Component\Console\Input\InputDefinition;
|
use Symfony\Component\Console\Input\InputDefinition;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace AppBundle\Exception;
|
namespace LoaderBundle\Exception;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace AppBundle\Exception;
|
namespace LoaderBundle\Exception;
|
||||||
|
|
||||||
use Throwable;
|
use Throwable;
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace AppBundle\Exception;
|
namespace LoaderBundle\Exception;
|
||||||
|
|
||||||
use Throwable;
|
use Throwable;
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace AppBundle\Exception;
|
namespace LoaderBundle\Exception;
|
||||||
|
|
||||||
use Throwable;
|
use Throwable;
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace AppBundle\Exception\Loader;
|
namespace LoaderBundle\Exception\Loader;
|
||||||
|
|
||||||
use Symfony\Component\Form\Exception\LogicException;
|
use Symfony\Component\Form\Exception\LogicException;
|
||||||
use Throwable;
|
use Throwable;
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace AppBundle\Exception;
|
namespace LoaderBundle\Exception;
|
||||||
|
|
||||||
use Throwable;
|
use Throwable;
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace AppBundle\Exception\RelationMapper;
|
namespace LoaderBundle\Exception\RelationMapper;
|
||||||
|
|
||||||
class InvalidResourceException extends \LogicException
|
class InvalidResourceException extends \LogicException
|
||||||
{
|
{
|
@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace AppBundle\Exception\RelationMapper;
|
namespace LoaderBundle\Exception\RelationMapper;
|
||||||
|
|
||||||
use AppBundle\Exception\FileException;
|
use LoaderBundle\Exception\FileException;
|
||||||
use Throwable;
|
use Throwable;
|
||||||
|
|
||||||
class ResourceNotFoundException extends FileException
|
class ResourceNotFoundException extends FileException
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace AppBundle\Exception;
|
namespace LoaderBundle\Exception;
|
||||||
|
|
||||||
use Throwable;
|
use Throwable;
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace AppBundle\Exception\Stl;
|
namespace LoaderBundle\Exception\Stl;
|
||||||
|
|
||||||
use Symfony\Component\Form\Exception\LogicException;
|
use Symfony\Component\Form\Exception\LogicException;
|
||||||
use Throwable;
|
use Throwable;
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace AppBundle\Exception;
|
namespace LoaderBundle\Exception;
|
||||||
|
|
||||||
use Throwable;
|
use Throwable;
|
||||||
|
|
9
src/LoaderBundle/LoaderBundle.php
Normal file
9
src/LoaderBundle/LoaderBundle.php
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace LoaderBundle;
|
||||||
|
|
||||||
|
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
||||||
|
|
||||||
|
class LoaderBundle extends Bundle
|
||||||
|
{
|
||||||
|
}
|
@ -1,12 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace AppBundle\Service\Loader;
|
namespace LoaderBundle\Service;
|
||||||
|
|
||||||
use AppBundle\Exception\FileNotFoundException;
|
|
||||||
use AppBundle\Exception\WriteErrorException;
|
|
||||||
use AppBundle\Transformer\FormatTransformer;
|
use AppBundle\Transformer\FormatTransformer;
|
||||||
use Doctrine\ORM\EntityManager;
|
use Doctrine\ORM\EntityManager;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use LoaderBundle\Exception\FileNotFoundException;
|
||||||
|
use LoaderBundle\Exception\WriteErrorException;
|
||||||
use Monolog\Logger;
|
use Monolog\Logger;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
use Symfony\Component\Asset\Exception\LogicException;
|
use Symfony\Component\Asset\Exception\LogicException;
|
@ -1,11 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace AppBundle\Service\Loader;
|
namespace LoaderBundle\Service;
|
||||||
|
|
||||||
use AppBundle\Entity\LDraw\Model;
|
use AppBundle\Entity\LDraw\Model;
|
||||||
use AppBundle\Service\Stl\StlRendererService;
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use League\Flysystem\FilesystemInterface;
|
use League\Flysystem\FilesystemInterface;
|
||||||
|
use LoaderBundle\Service\Stl\StlRendererService;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
class ImageLoader extends BaseLoader
|
class ImageLoader extends BaseLoader
|
||||||
@ -29,9 +29,9 @@ class ImageLoader extends BaseLoader
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Download ZIP file with part images from rebrickable and unzip file to filesystem
|
* Download ZIP file with part images from rebrickable and unzip file to filesystem.
|
||||||
*
|
*
|
||||||
* @param integer $color color id used by rebrickable
|
* @param int $color color id used by rebrickable
|
||||||
*/
|
*/
|
||||||
public function loadColorFromRebrickable($color)
|
public function loadColorFromRebrickable($color)
|
||||||
{
|
{
|
||||||
@ -53,7 +53,7 @@ class ImageLoader extends BaseLoader
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load missing images of models
|
* Load missing images of models.
|
||||||
*/
|
*/
|
||||||
public function loadMissingModelImages()
|
public function loadMissingModelImages()
|
||||||
{
|
{
|
||||||
@ -70,7 +70,7 @@ class ImageLoader extends BaseLoader
|
|||||||
|
|
||||||
// Render images
|
// Render images
|
||||||
$this->output->writeln([
|
$this->output->writeln([
|
||||||
"Rendering missing images of models",
|
'Rendering missing images of models',
|
||||||
]);
|
]);
|
||||||
$this->initProgressBar(count($missing));
|
$this->initProgressBar(count($missing));
|
||||||
foreach ($missing as $model) {
|
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
|
* @param $file
|
||||||
*/
|
*/
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace AppBundle\Service\Loader;
|
namespace LoaderBundle\Service;
|
||||||
|
|
||||||
use AppBundle\Entity\LDraw\Alias;
|
use AppBundle\Entity\LDraw\Alias;
|
||||||
use AppBundle\Entity\LDraw\Author;
|
use AppBundle\Entity\LDraw\Author;
|
||||||
@ -8,18 +8,18 @@ use AppBundle\Entity\LDraw\Category;
|
|||||||
use AppBundle\Entity\LDraw\Keyword;
|
use AppBundle\Entity\LDraw\Keyword;
|
||||||
use AppBundle\Entity\LDraw\Model;
|
use AppBundle\Entity\LDraw\Model;
|
||||||
use AppBundle\Entity\LDraw\Subpart;
|
use AppBundle\Entity\LDraw\Subpart;
|
||||||
use AppBundle\Exception\ConvertingFailedException;
|
|
||||||
use AppBundle\Exception\FileException;
|
|
||||||
use AppBundle\Exception\Loader\MissingContextException;
|
|
||||||
use AppBundle\Exception\ParseErrorException;
|
|
||||||
use AppBundle\Repository\LDraw\ModelRepository;
|
use AppBundle\Repository\LDraw\ModelRepository;
|
||||||
use AppBundle\Service\Stl\StlConverterService;
|
|
||||||
use AppBundle\Util\LDModelParser;
|
|
||||||
use AppBundle\Util\RelationMapper;
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use League\Flysystem\Adapter\Local;
|
use League\Flysystem\Adapter\Local;
|
||||||
use League\Flysystem\Exception;
|
use League\Flysystem\Exception;
|
||||||
use League\Flysystem\Filesystem;
|
use League\Flysystem\Filesystem;
|
||||||
|
use LoaderBundle\Exception\ConvertingFailedException;
|
||||||
|
use LoaderBundle\Exception\FileException;
|
||||||
|
use LoaderBundle\Exception\Loader\MissingContextException;
|
||||||
|
use LoaderBundle\Exception\ParseErrorException;
|
||||||
|
use LoaderBundle\Service\Stl\StlConverterService;
|
||||||
|
use LoaderBundle\Util\LDModelParser;
|
||||||
|
use LoaderBundle\Util\RelationMapper;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
class ModelLoader extends BaseLoader
|
class ModelLoader extends BaseLoader
|
||||||
@ -88,9 +88,10 @@ class ModelLoader extends BaseLoader
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Download library form $url, unzip archive and return directory path with library
|
* Download library form $url, unzip archive and return directory path with library.
|
||||||
*
|
*
|
||||||
* @param $url
|
* @param $url
|
||||||
|
*
|
||||||
* @return bool|string
|
* @return bool|string
|
||||||
*/
|
*/
|
||||||
public function downloadLibrary($url)
|
public function downloadLibrary($url)
|
||||||
@ -120,7 +121,7 @@ class ModelLoader extends BaseLoader
|
|||||||
$this->writeOutput(['<info>LDraw libary downloaded</info>']);
|
$this->writeOutput(['<info>LDraw libary downloaded</info>']);
|
||||||
|
|
||||||
// return ldraw directory if in zip file
|
// return ldraw directory if in zip file
|
||||||
if(file_exists($temp_dir.'/ldraw/')) {
|
if (file_exists($temp_dir.'/ldraw/')) {
|
||||||
return $temp_dir.'/ldraw/';
|
return $temp_dir.'/ldraw/';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,7 +184,7 @@ class ModelLoader extends BaseLoader
|
|||||||
$this->loadModel($this->ldrawLibraryContext->getAdapter()->getPathPrefix().$file['path']);
|
$this->loadModel($this->ldrawLibraryContext->getAdapter()->getPathPrefix().$file['path']);
|
||||||
|
|
||||||
// clear managed objects to avoid memory issues
|
// clear managed objects to avoid memory issues
|
||||||
if($index++ % 50 == 0) {
|
if ($index++ % 50 == 0) {
|
||||||
$this->em->clear();
|
$this->em->clear();
|
||||||
}
|
}
|
||||||
$connection->commit();
|
$connection->commit();
|
||||||
@ -215,7 +216,7 @@ class ModelLoader extends BaseLoader
|
|||||||
|
|
||||||
// Return model from database if rewrite is not enabled
|
// Return model from database if rewrite is not enabled
|
||||||
if (!$this->rewrite && $model = $modelRepository->find(basename($file, '.dat'))) {
|
if (!$this->rewrite && $model = $modelRepository->find(basename($file, '.dat'))) {
|
||||||
/** @var Model $model */
|
/* @var Model $model */
|
||||||
return $model;
|
return $model;
|
||||||
}
|
}
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace AppBundle\Service\Loader;
|
namespace LoaderBundle\Service;
|
||||||
|
|
||||||
use AppBundle\Entity\Rebrickable\Part;
|
use AppBundle\Entity\Rebrickable\Part;
|
||||||
use AppBundle\Entity\Rebrickable\Set;
|
use AppBundle\Entity\Rebrickable\Set;
|
||||||
@ -29,6 +29,11 @@ class RebrickableLoader extends BaseLoader
|
|||||||
parent::__construct($em, $logger);
|
parent::__construct($em, $logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Truncates and loads all rebrickable tables from csv files
|
||||||
|
*
|
||||||
|
* @throws \Exception
|
||||||
|
*/
|
||||||
public function loadAll()
|
public function loadAll()
|
||||||
{
|
{
|
||||||
$connection = $this->em->getConnection();
|
$connection = $this->em->getConnection();
|
||||||
@ -62,11 +67,16 @@ class RebrickableLoader extends BaseLoader
|
|||||||
|
|
||||||
$this->writeOutput(['Rebrickable database loaded successfully!']);
|
$this->writeOutput(['Rebrickable database loaded successfully!']);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
$this->writeOutput(['Rollback back']);
|
||||||
$connection->rollBack();
|
$connection->rollBack();
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Downloads csv files from rebrickable_url specified in config.yml
|
||||||
|
*/
|
||||||
private function loadCSVFiles()
|
private function loadCSVFiles()
|
||||||
{
|
{
|
||||||
$array = ['inventories', 'inventory_parts', 'inventory_sets', 'sets', 'themes', 'parts', 'part_categories', 'colors'];
|
$array = ['inventories', 'inventory_parts', 'inventory_sets', 'sets', 'themes', 'parts', 'part_categories', 'colors'];
|
||||||
@ -84,21 +94,33 @@ class RebrickableLoader extends BaseLoader
|
|||||||
$this->writeOutput(['<info>All CSV files loaded.</info>']);
|
$this->writeOutput(['<info>All CSV files loaded.</info>']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Truncate content of rebrickable tables.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
private function truncateTables()
|
private function truncateTables()
|
||||||
{
|
{
|
||||||
$query = '
|
$query = '
|
||||||
TRUNCATE TABLE rebrickable_inventory_parts;
|
DELETE FROM rebrickable_inventory_parts;
|
||||||
TRUNCATE TABLE rebrickable_inventory_sets;
|
DELETE FROM rebrickable_inventory_sets;
|
||||||
TRUNCATE TABLE rebrickable_inventory;
|
DELETE FROM rebrickable_inventory;
|
||||||
TRUNCATE TABLE rebrickable_set;
|
DELETE FROM rebrickable_set;
|
||||||
TRUNCATE TABLE rebrickable_theme;
|
DELETE FROM rebrickable_theme;
|
||||||
TRUNCATE TABLE rebrickable_part;
|
DELETE FROM rebrickable_part;
|
||||||
TRUNCATE TABLE rebrickable_category;
|
DELETE FROM rebrickable_category;
|
||||||
';
|
';
|
||||||
|
|
||||||
return $this->em->getConnection()->prepare($query)->execute();
|
return $this->em->getConnection()->prepare($query)->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $file
|
||||||
|
* @param $table
|
||||||
|
* @param $columns
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
private function loadCsvFile($file, $table, $columns)
|
private function loadCsvFile($file, $table, $columns)
|
||||||
{
|
{
|
||||||
$query = sprintf("LOAD DATA LOCAL INFILE '%s'
|
$query = sprintf("LOAD DATA LOCAL INFILE '%s'
|
@ -1,13 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace AppBundle\Service\Loader;
|
namespace LoaderBundle\Service;
|
||||||
|
|
||||||
use AppBundle\Entity\LDraw\Model;
|
use AppBundle\Entity\LDraw\Model;
|
||||||
use AppBundle\Entity\Rebrickable\Part;
|
use AppBundle\Entity\Rebrickable\Part;
|
||||||
use AppBundle\Repository\LDraw\ModelRepository;
|
use AppBundle\Repository\LDraw\ModelRepository;
|
||||||
use AppBundle\Repository\Rebrickable\PartRepository;
|
use AppBundle\Repository\Rebrickable\PartRepository;
|
||||||
use AppBundle\Util\RelationMapper;
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use LoaderBundle\Util\RelationMapper;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
class RelationLoader extends BaseLoader
|
class RelationLoader extends BaseLoader
|
||||||
@ -90,6 +90,7 @@ class RelationLoader extends BaseLoader
|
|||||||
$model = $this->modelRepository->findOneByName($part->getName());
|
$model = $this->modelRepository->findOneByName($part->getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $model;
|
return $model;
|
||||||
}
|
}
|
||||||
|
|
@ -1,12 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace AppBundle\Service\Stl;
|
namespace LoaderBundle\Service\Stl;
|
||||||
|
|
||||||
use AppBundle\Exception\ConvertingFailedException;
|
|
||||||
use AppBundle\Exception\Stl\LDLibraryMissingException;
|
|
||||||
use League\Flysystem\File;
|
use League\Flysystem\File;
|
||||||
use League\Flysystem\Filesystem;
|
use League\Flysystem\Filesystem;
|
||||||
use League\Flysystem\FilesystemInterface;
|
use League\Flysystem\FilesystemInterface;
|
||||||
|
use LoaderBundle\Exception\ConvertingFailedException;
|
||||||
|
use LoaderBundle\Exception\Stl\LDLibraryMissingException;
|
||||||
use Symfony\Component\Process\Exception\ProcessFailedException;
|
use Symfony\Component\Process\Exception\ProcessFailedException;
|
||||||
use Symfony\Component\Process\ProcessBuilder;
|
use Symfony\Component\Process\ProcessBuilder;
|
||||||
|
|
@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace AppBundle\Service\Stl;
|
namespace LoaderBundle\Service\Stl;
|
||||||
|
|
||||||
use AppBundle\Exception\FileNotFoundException;
|
use LoaderBundle\Exception\FileNotFoundException;
|
||||||
use Symfony\Component\Process\Exception\ProcessFailedException;
|
use Symfony\Component\Process\Exception\ProcessFailedException;
|
||||||
use Symfony\Component\Process\ProcessBuilder;
|
use Symfony\Component\Process\ProcessBuilder;
|
||||||
|
|
@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace AppBundle\Service\Stl;
|
namespace LoaderBundle\Service\Stl;
|
||||||
|
|
||||||
use AppBundle\Exception\ConvertingFailedException;
|
use LoaderBundle\Exception\ConvertingFailedException;
|
||||||
use AppBundle\Exception\FileNotFoundException;
|
use LoaderBundle\Exception\FileNotFoundException;
|
||||||
use AppBundle\Exception\RenderFailedException;
|
use LoaderBundle\Exception\RenderFailedException;
|
||||||
use Symfony\Component\Process\Process;
|
use Symfony\Component\Process\Process;
|
||||||
use Symfony\Component\Process\ProcessBuilder;
|
use Symfony\Component\Process\ProcessBuilder;
|
||||||
|
|
@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace AppBundle\Util;
|
namespace LoaderBundle\Util;
|
||||||
|
|
||||||
use AppBundle\Exception\ErrorParsingLineException;
|
use LoaderBundle\Exception\ErrorParsingLineException;
|
||||||
|
|
||||||
class LDModelParser
|
class LDModelParser
|
||||||
{
|
{
|
||||||
@ -28,8 +28,10 @@ class LDModelParser
|
|||||||
* LDraw.org Standards: Official Library Header Specification (http://www.ldraw.org/article/398.html)
|
* LDraw.org Standards: Official Library Header Specification (http://www.ldraw.org/article/398.html)
|
||||||
*
|
*
|
||||||
* @param $string
|
* @param $string
|
||||||
* @return array
|
*
|
||||||
* @throws ErrorParsingLineException
|
* @throws ErrorParsingLineException
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function parse($string)
|
public function parse($string)
|
||||||
{
|
{
|
@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace AppBundle\Util;
|
namespace LoaderBundle\Util;
|
||||||
|
|
||||||
use AppBundle\Exception\RelationMapper\InvalidResourceException;
|
|
||||||
use AppBundle\Exception\RelationMapper\ResourceNotFoundException;
|
|
||||||
use Doctrine\Common\Cache\CacheProvider;
|
use Doctrine\Common\Cache\CacheProvider;
|
||||||
|
use LoaderBundle\Exception\RelationMapper\InvalidResourceException;
|
||||||
|
use LoaderBundle\Exception\RelationMapper\ResourceNotFoundException;
|
||||||
use Symfony\Component\OptionsResolver\Exception\InvalidArgumentException;
|
use Symfony\Component\OptionsResolver\Exception\InvalidArgumentException;
|
||||||
use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException;
|
use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException;
|
||||||
use Symfony\Component\Yaml\Exception\ParseException;
|
use Symfony\Component\Yaml\Exception\ParseException;
|
||||||
@ -19,6 +19,7 @@ class RelationMapper
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* RelationMapper constructor.
|
* RelationMapper constructor.
|
||||||
|
*
|
||||||
* @param CacheProvider $cache
|
* @param CacheProvider $cache
|
||||||
*/
|
*/
|
||||||
public function __construct(CacheProvider $cache)
|
public function __construct(CacheProvider $cache)
|
||||||
@ -26,7 +27,6 @@ class RelationMapper
|
|||||||
$this->cache = $cache;
|
$this->cache = $cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a Resource.
|
* Adds a Resource.
|
||||||
*
|
*
|
||||||
@ -43,7 +43,7 @@ class RelationMapper
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if (!$data = unserialize($this->cache->fetch($domain))) {
|
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);
|
$this->cache->save($domain, serialize($data), 60);
|
||||||
}
|
}
|
||||||
|
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace Tests\AppBundle\Fixtures;
|
namespace Tests\AppBundle\Fixtures;
|
||||||
|
|
||||||
|
|
||||||
use AppBundle\Entity\Color;
|
use AppBundle\Entity\Color;
|
||||||
use AppBundle\Entity\LDraw\Author;
|
use AppBundle\Entity\LDraw\Author;
|
||||||
use AppBundle\Entity\LDraw\Model;
|
use AppBundle\Entity\LDraw\Model;
|
||||||
|
@ -30,7 +30,7 @@ class ZipServiceTest extends BaseTest
|
|||||||
$this->modelService = $this->get(ModelService::class);
|
$this->modelService = $this->get(ModelService::class);
|
||||||
$this->setService = $this->get(SetService::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);
|
$this->zipService = new ZipService($this->filesystem,$this->modelService,$this->setService);
|
||||||
}
|
}
|
||||||
@ -42,7 +42,7 @@ class ZipServiceTest extends BaseTest
|
|||||||
|
|
||||||
public function testModelZip()
|
public function testModelZip()
|
||||||
{
|
{
|
||||||
$model = $this->modelService->findModel(1);
|
$model = $this->modelService->find(1);
|
||||||
|
|
||||||
$path = $this->zipService->createFromModel($model, 'modelzip');
|
$path = $this->zipService->createFromModel($model, 'modelzip');
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ class ZipServiceTest extends BaseTest
|
|||||||
|
|
||||||
public function testSetZip()
|
public function testSetZip()
|
||||||
{
|
{
|
||||||
$set = $this->setService->findSet('8049-1');
|
$set = $this->setService->find('8049-1');
|
||||||
|
|
||||||
$path = $this->zipService->createFromSet($set, 'setzip');
|
$path = $this->zipService->createFromSet($set, 'setzip');
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Tests\AppBundle;
|
namespace Tests\FrontBundle;
|
||||||
|
|
||||||
use Tests\AppBundle\Controller\BaseControllerTest;
|
use Tests\FrontBundle\Controller\BaseControllerTest;
|
||||||
|
|
||||||
class ApplicationAvailabilityTest extends BaseControllerTest
|
class ApplicationAvailabilityTest extends BaseControllerTest
|
||||||
{
|
{
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Tests\AppBundle\Controller;
|
namespace Tests\FrontBundle\Controller;
|
||||||
|
|
||||||
use Liip\FunctionalTestBundle\Test\WebTestCase;
|
use Liip\FunctionalTestBundle\Test\WebTestCase;
|
||||||
use Tests\AppBundle\Fixtures\LoadBaseData;
|
use Tests\AppBundle\Fixtures\LoadBaseData;
|
@ -1,14 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Tests\AppBundle\Service\Loader\ModelLoader;
|
namespace Tests\LoaderBundle\Service\ModelLoader;
|
||||||
|
|
||||||
use AppBundle\Entity\LDraw\Alias;
|
use AppBundle\Entity\LDraw\Alias;
|
||||||
use AppBundle\Entity\LDraw\Model;
|
use AppBundle\Entity\LDraw\Model;
|
||||||
use AppBundle\Repository\LDraw\AliasRepository;
|
use AppBundle\Repository\LDraw\AliasRepository;
|
||||||
use AppBundle\Repository\LDraw\ModelRepository;
|
use AppBundle\Repository\LDraw\ModelRepository;
|
||||||
use AppBundle\Service\Loader\ModelLoader;
|
use LoaderBundle\Service\ModelLoader;
|
||||||
use AppBundle\Service\Stl\StlConverterService;
|
use LoaderBundle\Service\Stl\StlConverterService;
|
||||||
use AppBundle\Util\RelationMapper;
|
use LoaderBundle\Util\RelationMapper;
|
||||||
use League\Flysystem\File;
|
use League\Flysystem\File;
|
||||||
use League\Flysystem\Filesystem;
|
use League\Flysystem\Filesystem;
|
||||||
use Symfony\Component\Console\Output\NullOutput;
|
use Symfony\Component\Console\Output\NullOutput;
|
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
namespace Tests\AppBundle\Service\Stl;
|
namespace Tests\AppBundle\Service\Stl;
|
||||||
|
|
||||||
use AppBundle\Service\Stl\StlConverterService;
|
use LoaderBundle\Service\Stl\StlConverterService;
|
||||||
use AppBundle\Service\Stl\StlFixerService;
|
use LoaderBundle\Service\Stl\StlFixerService;
|
||||||
use League\Flysystem\Adapter\Local;
|
use League\Flysystem\Adapter\Local;
|
||||||
use League\Flysystem\Filesystem;
|
use League\Flysystem\Filesystem;
|
||||||
use Tests\AppBundle\BaseTest;
|
use Tests\AppBundle\BaseTest;
|
||||||
@ -40,7 +40,7 @@ class StlConverterTest extends BaseTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException AppBundle\Exception\Stl\LDLibraryMissingException
|
* @expectedException LoaderBundle\Exception\Stl\LDLibraryMissingException
|
||||||
*/
|
*/
|
||||||
public function testLDContextMissing()
|
public function testLDContextMissing()
|
||||||
{
|
{
|
@ -2,13 +2,11 @@
|
|||||||
|
|
||||||
namespace Tests\AppBundle\Service\Stl;
|
namespace Tests\AppBundle\Service\Stl;
|
||||||
|
|
||||||
use AppBundle\Service\Stl\StlConverterService;
|
use LoaderBundle\Service\Stl\StlConverterService;
|
||||||
use AppBundle\Service\Stl\StlFixerService;
|
use LoaderBundle\Service\Stl\StlFixerService;
|
||||||
use League\Flysystem\Adapter\Local;
|
use League\Flysystem\Adapter\Local;
|
||||||
use League\Flysystem\Filesystem;
|
use League\Flysystem\Filesystem;
|
||||||
use League\Flysystem\FilesystemInterface;
|
use League\Flysystem\FilesystemInterface;
|
||||||
use org\bovigo\vfs\vfsStreamDirectory;
|
|
||||||
use org\bovigo\vfs\vfsStreamWrapper;
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Tests\AppBundle\BaseTest;
|
use Tests\AppBundle\BaseTest;
|
||||||
|
|
@ -2,14 +2,12 @@
|
|||||||
|
|
||||||
namespace Tests\AppBundle\Service\Stl;
|
namespace Tests\AppBundle\Service\Stl;
|
||||||
|
|
||||||
use AppBundle\Service\Stl\StlConverterService;
|
use LoaderBundle\Service\Stl\StlConverterService;
|
||||||
use AppBundle\Service\Stl\StlFixerService;
|
use LoaderBundle\Service\Stl\StlFixerService;
|
||||||
use AppBundle\Service\Stl\StlRendererService;
|
use LoaderBundle\Service\Stl\StlRendererService;
|
||||||
use League\Flysystem\Adapter\Local;
|
use League\Flysystem\Adapter\Local;
|
||||||
use League\Flysystem\Filesystem;
|
use League\Flysystem\Filesystem;
|
||||||
use League\Flysystem\FilesystemInterface;
|
use League\Flysystem\FilesystemInterface;
|
||||||
use org\bovigo\vfs\vfsStreamDirectory;
|
|
||||||
use org\bovigo\vfs\vfsStreamWrapper;
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Tests\AppBundle\BaseTest;
|
use Tests\AppBundle\BaseTest;
|
||||||
|
|
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 50 KiB |
@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Tests\AppBundle\Util\LDModelParser;
|
namespace Tests\LoaderBundle\Util\LDModelParser;
|
||||||
|
|
||||||
use AppBundle\Exception\ErrorParsingLineException;
|
use AppBundle\Exception\ErrorParsingLineException;
|
||||||
use AppBundle\Exception\ParseErrorException;
|
use AppBundle\Exception\ParseErrorException;
|
||||||
use AppBundle\Util\LDModelParser;
|
use LoaderBundle\Util\LDModelParser;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Component\Validator\Constraints\DateTime;
|
use Symfony\Component\Validator\Constraints\DateTime;
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ class LDModelParserTest extends TestCase
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException AppBundle\Exception\ErrorParsingLineException
|
* @expectedException LoaderBundle\Exception\ErrorParsingLineException
|
||||||
*/
|
*/
|
||||||
public function testInvalid()
|
public function testInvalid()
|
||||||
{
|
{
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user