mirror of
https://github.com/ToxicCrack/PrintABrick.git
synced 2025-05-18 13:10:08 -07:00
Refactor services configuration
This commit is contained in:
parent
8ebde0c02f
commit
81094348bf
14
app/config/service/api.yml
Normal file
14
app/config/service/api.yml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
services:
|
||||||
|
client.brickset:
|
||||||
|
class: AppBundle\Api\Client\Brickset\Brickset
|
||||||
|
arguments: ['%brickset_apikey%']
|
||||||
|
client.rebrickable:
|
||||||
|
class: AppBundle\Api\Client\Rebrickable\Rebrickable_v3
|
||||||
|
arguments: ['%rebrickable_apikey%']
|
||||||
|
|
||||||
|
manager.brickset:
|
||||||
|
class: AppBundle\Api\Manager\BricksetManager
|
||||||
|
arguments: ['@client.brickset']
|
||||||
|
manager.rebrickable:
|
||||||
|
class: AppBundle\Api\Manager\RebrickableManager
|
||||||
|
arguments: ['@client.rebrickable']
|
21
app/config/service/loader.yml
Normal file
21
app/config/service/loader.yml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
services:
|
||||||
|
service.loader:
|
||||||
|
abstract: true
|
||||||
|
class: AppBundle\Loader\Loader
|
||||||
|
arguments: ['@doctrine.orm.entity_manager']
|
||||||
|
|
||||||
|
service.ldview:
|
||||||
|
class: AppBundle\Service\LDViewService
|
||||||
|
arguments: ['%ldview_bin%', '@oneup_flysystem.media_filesystem']
|
||||||
|
|
||||||
|
loader.rebrickable:
|
||||||
|
class: AppBundle\Loader\RebrickableLoader
|
||||||
|
calls:
|
||||||
|
- [setArguments, ['@manager.rebrickable', '%rebrickable_url%']]
|
||||||
|
parent: service.loader
|
||||||
|
|
||||||
|
loader.ldraw:
|
||||||
|
class: AppBundle\Loader\LDrawLoader
|
||||||
|
calls:
|
||||||
|
- [setArguments, ['@service.ldview', '%ldraw_url%', '@service.ldraw']]
|
||||||
|
parent: service.loader
|
23
app/config/service/manager.yml
Normal file
23
app/config/service/manager.yml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
services:
|
||||||
|
manager.ldraw.keyword:
|
||||||
|
class: AppBundle\Manager\LDraw\KeywordManager
|
||||||
|
arguments:
|
||||||
|
- "@repository.ldraw.keyword"
|
||||||
|
manager.ldraw.category:
|
||||||
|
class: AppBundle\Manager\LDraw\CategoryManager
|
||||||
|
arguments:
|
||||||
|
- "@repository.ldraw.category"
|
||||||
|
manager.ldraw.type:
|
||||||
|
class: AppBundle\Manager\LDraw\TypeManager
|
||||||
|
arguments:
|
||||||
|
- "@repository.ldraw.type"
|
||||||
|
manager.ldraw.part:
|
||||||
|
class: AppBundle\Manager\LDraw\PartManager
|
||||||
|
arguments:
|
||||||
|
- "@repository.ldraw.part"
|
||||||
|
manager.ldraw.partRelation:
|
||||||
|
class: AppBundle\Manager\LDraw\Part_RelationManager
|
||||||
|
arguments:
|
||||||
|
- "@repository.ldraw.partRelation"
|
||||||
|
|
||||||
|
|
78
app/config/service/repository.yml
Normal file
78
app/config/service/repository.yml
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
services:
|
||||||
|
repository.ldraw.keyword:
|
||||||
|
class: Doctrine\ORM\EntityRepository
|
||||||
|
factory: ["@doctrine", getRepository]
|
||||||
|
arguments:
|
||||||
|
- AppBundle\Entity\LDraw\Keyword
|
||||||
|
|
||||||
|
repository.ldraw.category:
|
||||||
|
class: Doctrine\ORM\EntityRepository
|
||||||
|
factory: ["@doctrine", getRepository]
|
||||||
|
arguments:
|
||||||
|
- AppBundle\Entity\LDraw\Category
|
||||||
|
|
||||||
|
repository.ldraw.model:
|
||||||
|
class: Doctrine\ORM\EntityRepository
|
||||||
|
factory: ["@doctrine", getRepository]
|
||||||
|
arguments:
|
||||||
|
- AppBundle\Entity\LDraw\Model
|
||||||
|
|
||||||
|
repository.ldraw.part:
|
||||||
|
class: Doctrine\ORM\EntityRepository
|
||||||
|
factory: ["@doctrine", getRepository]
|
||||||
|
arguments:
|
||||||
|
- AppBundle\Entity\LDraw\Part
|
||||||
|
|
||||||
|
repository.ldraw.type:
|
||||||
|
class: Doctrine\ORM\EntityRepository
|
||||||
|
factory: ["@doctrine", getRepository]
|
||||||
|
arguments:
|
||||||
|
- AppBundle\Entity\LDraw\Type
|
||||||
|
|
||||||
|
repository.ldraw.partRelation:
|
||||||
|
class: Doctrine\ORM\EntityRepository
|
||||||
|
factory: ["@doctrine", getRepository]
|
||||||
|
arguments:
|
||||||
|
- AppBundle\Entity\LDraw\Part_Relation
|
||||||
|
|
||||||
|
repository.rebrickable.category:
|
||||||
|
class: Doctrine\ORM\EntityRepository
|
||||||
|
factory: ["@doctrine", getRepository]
|
||||||
|
arguments:
|
||||||
|
- AppBundle\Entity\Rebrickable\Category
|
||||||
|
|
||||||
|
repository.rebrickable.color:
|
||||||
|
class: Doctrine\ORM\EntityRepository
|
||||||
|
factory: ["@doctrine", getRepository]
|
||||||
|
arguments:
|
||||||
|
- AppBundle\Entity\Rebrickable\Color
|
||||||
|
|
||||||
|
repository.rebrickable.inventory:
|
||||||
|
class: Doctrine\ORM\EntityRepository
|
||||||
|
factory: ["@doctrine", getRepository]
|
||||||
|
arguments:
|
||||||
|
- AppBundle\Entity\Rebrickable\Inventory
|
||||||
|
|
||||||
|
repository.rebrickable.inventoryPart:
|
||||||
|
class: Doctrine\ORM\EntityRepository
|
||||||
|
factory: ["@doctrine", getRepository]
|
||||||
|
arguments:
|
||||||
|
- AppBundle\Entity\Rebrickable\Inventory_Part
|
||||||
|
|
||||||
|
repository.rebrickable.part:
|
||||||
|
class: Doctrine\ORM\EntityRepository
|
||||||
|
factory: ["@doctrine", getRepository]
|
||||||
|
arguments:
|
||||||
|
- AppBundle\Entity\Rebrickable\Part
|
||||||
|
|
||||||
|
repository.rebrickable.set:
|
||||||
|
class: Doctrine\ORM\EntityRepository
|
||||||
|
factory: ["@doctrine", getRepository]
|
||||||
|
arguments:
|
||||||
|
- AppBundle\Entity\Rebrickable\Set
|
||||||
|
|
||||||
|
repository.rebrickable.theme:
|
||||||
|
class: Doctrine\ORM\EntityRepository
|
||||||
|
factory: ["@doctrine", getRepository]
|
||||||
|
arguments:
|
||||||
|
- AppBundle\Entity\Rebrickable\Theme
|
19
app/config/service/service.yml
Normal file
19
app/config/service/service.yml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
services:
|
||||||
|
sevice.collection:
|
||||||
|
class: AppBundle\Service\CollectionService
|
||||||
|
arguments: ['@doctrine', '@manager.brickset','@manager.rebrickable']
|
||||||
|
|
||||||
|
service.ldraw:
|
||||||
|
class: AppBundle\Service\LDrawService
|
||||||
|
arguments:
|
||||||
|
- '@manager.ldraw.category'
|
||||||
|
- '@manager.ldraw.keyword'
|
||||||
|
- '@manager.ldraw.type'
|
||||||
|
- '@manager.ldraw.part'
|
||||||
|
- '@manager.ldraw.partRelation'
|
||||||
|
|
||||||
|
app.form.filter_set:
|
||||||
|
class: AppBundle\Form\FilterSetType
|
||||||
|
arguments: ['@manager.brickset']
|
||||||
|
tags:
|
||||||
|
- { name: form.type }
|
@ -1,45 +1,6 @@
|
|||||||
services:
|
imports:
|
||||||
client.brickset:
|
- { resource: service/repository.yml }
|
||||||
class: AppBundle\Api\Client\Brickset\Brickset
|
- { resource: service/api.yml }
|
||||||
arguments: ['%brickset_apikey%']
|
- { resource: service/loader.yml }
|
||||||
client.rebrickable:
|
- { resource: service/manager.yml }
|
||||||
class: AppBundle\Api\Client\Rebrickable\Rebrickable_v3
|
- { resource: service/service.yml }
|
||||||
arguments: ['%rebrickable_apikey%']
|
|
||||||
|
|
||||||
manager.brickset:
|
|
||||||
class: AppBundle\Api\Manager\BricksetManager
|
|
||||||
arguments: ['@client.brickset']
|
|
||||||
manager.rebrickable:
|
|
||||||
class: AppBundle\Api\Manager\RebrickableManager
|
|
||||||
arguments: ['@client.rebrickable']
|
|
||||||
|
|
||||||
sevice.collection:
|
|
||||||
class: AppBundle\Service\CollectionService
|
|
||||||
arguments: ['@doctrine.orm.entity_manager', '@manager.brickset','@manager.rebrickable']
|
|
||||||
|
|
||||||
service.loader:
|
|
||||||
abstract: true
|
|
||||||
class: AppBundle\Loader\Loader
|
|
||||||
arguments: ['@doctrine.orm.entity_manager']
|
|
||||||
|
|
||||||
service.ldview:
|
|
||||||
class: AppBundle\Service\LDViewService
|
|
||||||
arguments: ['%ldview_bin%', '@oneup_flysystem.media_filesystem']
|
|
||||||
|
|
||||||
loader.rebrickable:
|
|
||||||
class: AppBundle\Loader\RebrickableLoader
|
|
||||||
calls:
|
|
||||||
- [setArguments, ['@manager.rebrickable', '%rebrickable_url%']]
|
|
||||||
parent: service.loader
|
|
||||||
|
|
||||||
loader.ldraw:
|
|
||||||
class: AppBundle\Loader\LDrawLoader
|
|
||||||
calls:
|
|
||||||
- [setArguments, ['@service.ldview', '%ldraw_url%']]
|
|
||||||
parent: service.loader
|
|
||||||
|
|
||||||
app.form.filter_set:
|
|
||||||
class: AppBundle\Form\FilterSetType
|
|
||||||
arguments: ['@manager.brickset']
|
|
||||||
tags:
|
|
||||||
- { name: form.type }
|
|
||||||
|
85
src/AppBundle/Service/LDrawService.php
Normal file
85
src/AppBundle/Service/LDrawService.php
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace AppBundle\Service;
|
||||||
|
|
||||||
|
use AppBundle\Manager\LDraw\CategoryManager;
|
||||||
|
use AppBundle\Manager\LDraw\KeywordManager;
|
||||||
|
use AppBundle\Manager\LDraw\Part_RelationManager;
|
||||||
|
use AppBundle\Manager\LDraw\PartManager;
|
||||||
|
use AppBundle\Manager\LDraw\TypeManager;
|
||||||
|
|
||||||
|
class LDrawService
|
||||||
|
{
|
||||||
|
/** @var CategoryManager */
|
||||||
|
private $categoryManager;
|
||||||
|
|
||||||
|
/** @var KeywordManager */
|
||||||
|
private $keywordManager;
|
||||||
|
|
||||||
|
/** @var TypeManager */
|
||||||
|
private $typeManager;
|
||||||
|
|
||||||
|
/** @var PartManager */
|
||||||
|
private $partManager;
|
||||||
|
|
||||||
|
/** @var Part_RelationManager */
|
||||||
|
private $partRelationManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LDrawService constructor.
|
||||||
|
*
|
||||||
|
* @param CategoryManager $categoryManager
|
||||||
|
* @param KeywordManager $keywordManager
|
||||||
|
* @param TypeManager $typeManager
|
||||||
|
* @param PartManager $partManager
|
||||||
|
* @param Part_RelationManager $partRelationManager
|
||||||
|
*/
|
||||||
|
public function __construct(CategoryManager $categoryManager, KeywordManager $keywordManager, TypeManager $typeManager, PartManager $partManager, Part_RelationManager $partRelationManager)
|
||||||
|
{
|
||||||
|
$this->categoryManager = $categoryManager;
|
||||||
|
$this->keywordManager = $keywordManager;
|
||||||
|
$this->typeManager = $typeManager;
|
||||||
|
$this->partManager = $partManager;
|
||||||
|
$this->partRelationManager = $partRelationManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getCategoryManager()
|
||||||
|
{
|
||||||
|
return $this->categoryManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getKeywordManager()
|
||||||
|
{
|
||||||
|
return $this->keywordManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return TypeManager
|
||||||
|
*/
|
||||||
|
public function getTypeManager()
|
||||||
|
{
|
||||||
|
return $this->typeManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return PartManager
|
||||||
|
*/
|
||||||
|
public function getPartManager()
|
||||||
|
{
|
||||||
|
return $this->partManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Part_RelationManager
|
||||||
|
*/
|
||||||
|
public function getPartRelationManager()
|
||||||
|
{
|
||||||
|
return $this->partRelationManager;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user