-
Notifications
You must be signed in to change notification settings - Fork 34
Synthetic
Mauro Gadaleta edited this page Jun 28, 2023
·
2 revisions
In some applications, you may need to inject a class instance as service, instead of configuring the container to create a new instance.
services:
# synthetic services don't specify a class
app.synthetic_service:
synthetic: true
let definition = container.register('app.synthetic_service')
definition.synthetic = true
Now, you can inject the instance in the container using container.set()
method:
let instantiatedService = ...;
container.set('app.synthetic_service', instantiatedService);
Copyright © 2023-2024 Mauro Gadaleta