mirror of
https://github.com/wallabag/wallabag.git
synced 2025-08-01 17:38:38 +00:00
Move to controller as a service
Mostly using autowiring to inject deps. The only tricky part was for import because all producer use the same class and have a different alias. So we must write them down in the service definition, autowiring doesn't work in that case. Usually: - if a controller has a constructor, it means injected services are at least re-used once in actions - otherwise, service are injected per action
This commit is contained in:
parent
39f603e015
commit
6aca334d53
36 changed files with 855 additions and 699 deletions
|
@ -7,7 +7,7 @@ _profiler:
|
|||
prefix: /_profiler
|
||||
|
||||
_errors:
|
||||
resource: "@TwigBundle/Resources/config/routing/errors.xml"
|
||||
resource: '@TwigBundle/Resources/config/routing/errors.xml'
|
||||
prefix: /_error
|
||||
|
||||
_main:
|
||||
|
|
|
@ -43,6 +43,79 @@ services:
|
|||
resource: '../../src/Wallabag/CoreBundle/*'
|
||||
exclude: ['../../src/Wallabag/CoreBundle/{Controller,Entity}', '../../src/Wallabag/CoreBundle/Event/*Event.php']
|
||||
|
||||
# controllers are imported separately to make sure services can be injected
|
||||
# as action arguments even if you don't extend any base controller class
|
||||
Wallabag\AnnotationBundle\Controller\:
|
||||
resource: '../../src/Wallabag/AnnotationBundle/Controller/'
|
||||
tags: ['controller.service_arguments']
|
||||
|
||||
Wallabag\ApiBundle\Controller\:
|
||||
resource: '../../src/Wallabag/ApiBundle/Controller/'
|
||||
tags: ['controller.service_arguments']
|
||||
|
||||
Wallabag\CoreBundle\Controller\:
|
||||
resource: '../../src/Wallabag/CoreBundle/Controller/'
|
||||
tags: ['controller.service_arguments']
|
||||
|
||||
Wallabag\ImportBundle\Controller\:
|
||||
resource: '../../src/Wallabag/ImportBundle/Controller/'
|
||||
tags: ['controller.service_arguments']
|
||||
|
||||
Wallabag\UserBundle\Controller\:
|
||||
resource: '../../src/Wallabag/UserBundle/Controller/'
|
||||
tags: ['controller.service_arguments']
|
||||
|
||||
# inject alias service into controllers
|
||||
Wallabag\ImportBundle\Controller\ChromeController:
|
||||
arguments:
|
||||
$rabbitMqProducer: '@old_sound_rabbit_mq.import_chrome_producer'
|
||||
$redisProducer: '@wallabag_import.producer.redis.chrome'
|
||||
|
||||
Wallabag\ImportBundle\Controller\DeliciousController:
|
||||
arguments:
|
||||
$rabbitMqProducer: '@old_sound_rabbit_mq.import_delicious_producer'
|
||||
$redisProducer: '@wallabag_import.producer.redis.delicious'
|
||||
|
||||
Wallabag\ImportBundle\Controller\ElcuratorController:
|
||||
arguments:
|
||||
$rabbitMqProducer: '@old_sound_rabbit_mq.import_elcurator_producer'
|
||||
$redisProducer: '@wallabag_import.producer.redis.elcurator'
|
||||
|
||||
Wallabag\ImportBundle\Controller\FirefoxController:
|
||||
arguments:
|
||||
$rabbitMqProducer: '@old_sound_rabbit_mq.import_firefox_producer'
|
||||
$redisProducer: '@wallabag_import.producer.redis.firefox'
|
||||
|
||||
Wallabag\ImportBundle\Controller\InstapaperController:
|
||||
arguments:
|
||||
$rabbitMqProducer: '@old_sound_rabbit_mq.import_instapaper_producer'
|
||||
$redisProducer: '@wallabag_import.producer.redis.instapaper'
|
||||
|
||||
Wallabag\ImportBundle\Controller\PinboardController:
|
||||
arguments:
|
||||
$rabbitMqProducer: '@old_sound_rabbit_mq.import_pinboard_producer'
|
||||
$redisProducer: '@wallabag_import.producer.redis.pinboard'
|
||||
|
||||
Wallabag\ImportBundle\Controller\PocketController:
|
||||
arguments:
|
||||
$rabbitMqProducer: '@old_sound_rabbit_mq.import_pocket_producer'
|
||||
$redisProducer: '@wallabag_import.producer.redis.pocket'
|
||||
|
||||
Wallabag\ImportBundle\Controller\ReadabilityController:
|
||||
arguments:
|
||||
$rabbitMqProducer: '@old_sound_rabbit_mq.import_readability_producer'
|
||||
$redisProducer: '@wallabag_import.producer.redis.readability'
|
||||
|
||||
Wallabag\ImportBundle\Controller\WallabagV1Controller:
|
||||
arguments:
|
||||
$rabbitMqProducer: '@old_sound_rabbit_mq.import_wallabag_v1_producer'
|
||||
$redisProducer: '@wallabag_import.producer.redis.wallabag_v1'
|
||||
|
||||
Wallabag\ImportBundle\Controller\WallabagV2Controller:
|
||||
arguments:
|
||||
$rabbitMqProducer: '@old_sound_rabbit_mq.import_wallabag_v2_producer'
|
||||
$redisProducer: '@wallabag_import.producer.redis.wallabag_v2'
|
||||
|
||||
Wallabag\ImportBundle\:
|
||||
resource: '../../src/Wallabag/ImportBundle/*'
|
||||
exclude: '../../src/Wallabag/ImportBundle/{Consumer,Controller,Redis}'
|
||||
|
@ -183,8 +256,6 @@ services:
|
|||
path: '%redis_path%'
|
||||
password: '%redis_password%'
|
||||
|
||||
Wallabag\CoreBundle\Controller\ExceptionController: ~
|
||||
|
||||
Wallabag\CoreBundle\Event\Subscriber\SQLiteCascadeDeleteSubscriber:
|
||||
tags:
|
||||
- { name: doctrine.event_subscriber }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue