-
Notifications
You must be signed in to change notification settings - Fork 35
Open
Description
Bind keyword to bind specific arguments by name or type:
or in pure js or typescript
const compiler = new ContainerBuilder(false, '../path/to/src')
compiler.addBind('adminEmail', '[email protected]')
compiler.addBind('someParameter', process.env.SOME_PARAMETER)
const autowire = new Autowire(compiler)or in yaml
services:
_defaults:
bind:
# pass this value to any adminEmail argument for any service
# that's defined in this file (including controller arguments)
adminEmail: '[email protected]'
# also if is coming from environment variables
someParameter: '%env(SOME_PARAMETER)%'Then you can use it it that way
export default class SomeService() {
constructor(
private readonly adminEmail: string,
private readonly someParameter: string,
) {}
}