Created
April 1, 2016 10:22
-
-
Save mlebkowski/1a89eb522e83775d340b3d96a8e01f23 to your computer and use it in GitHub Desktop.
Implementing strategy backend using nassau/registry-compiler
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Convert this configuration value to a container parameter: %foobar.api_strategy% | |
# | |
foobar: | |
api_strategy: readonly | |
services: | |
foobar.api.strategy: | |
class: 'FoobarBundle\Service\Api\StrategyApiService' | |
public: false | |
arguments: | |
- '@foobar.api.strategy.collection' | |
calls: | |
- [ 'setStrategy', [ '%foobar.api_strategy%' ] ] | |
# | |
# See: https://github.com/mlebkowski/registry-compiler - automatically collect services using tags | |
# | |
foobar.api.strategy.collection: | |
class: 'Doctrine\Common\Collections\ArrayCollection' | |
public: false | |
tags: | |
- name: nassau.registry # magic! | |
tag: foobar.service.strategy_api_service | |
order: indexed | |
alias_field: strategy | |
class: 'FoobarBundle\Service\Api\ApiServiceInterface' | |
foobar.service.api_service.strategy.logger: | |
class: 'FoobarBundle\Service\Api\LoggingApiService' | |
public: false | |
arguments: [ "@foobar.service.api_service.backend", "@logger" ] | |
tags: | |
- name: foobar.service.strategy_api_service | |
strategy: default | |
fobar.service.api_service.strategy.readonly: | |
public: false | |
class: 'FoobarBundle\Service\Api\ReadOnlyApiService' | |
arguments: [ "@foobar.service.api_service.strategy.logger" ] | |
tags: | |
- name: foobar.service.strategy_api_service | |
strategy: readonly | |
foobar.service.api_service.backend: | |
class: 'FoobarBundle\Service\Api\BackendApiService' | |
public: false | |
arguments: [ "@foobar.api.sdk" ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment