Skip to content

Instantly share code, notes, and snippets.

@h4cc
Last active December 21, 2015 08:39
Show Gist options
  • Save h4cc/6280029 to your computer and use it in GitHub Desktop.
Save h4cc/6280029 to your computer and use it in GitHub Desktop.
When using a service alias, a parameter in case of the alias name can NOT be used. Exceptions: 'InvalidArgumentException: Unable to replace alias "%my_alias%" with "bar".' 'InvalidArgumentException: The service definition "%my_alias%" does not exist.'
parameters:
my_alias: foo
services:
foo:
class: Example\Foo
bar:
alias: %my_alias%
#--------------------------------------------
# For clarification, a real life example:
# fos_user.repository.user would be a service from a different bundle.
# Via parameter the used service should be abled to change.
parameters:
my_bundle.repository.user.alias: fos_user.repository.user
services:
my_bundle.repository.user:
alias: %my_bundle.repository.user.alias%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment