Instantly share code, notes, and snippets.

Embed
What would you like to do?
Implementing strategy backend using nassau/registry-compiler
#
# 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