-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Closed
Labels
Description
Symfony version(s) affected: Symfony 4.1.7
Description
Using a parameterised boolean false
for the lazy
tag won't recognise it as boolean value. Hence reason, the service hello.service.calculator
below is never "lazy". It becomes lazy only if explicitly set is to false
.
How to reproduce
my_bundle.yaml
my_bundle:
parameter:
is_lazy: false
services.yaml
services:
hello.service.calculator:
class: AppBundle\Service\Calculator
lazy: '%my_bundle.parameter.is_lazy%'
Test
$ bin/console debug:container hello.service.calculator
---------------- ----------
Option Value
---------------- ----------
Service ID hello.service.calculator
Lazy yes
....
When I inject '%my_bundle.parameter.is_lazy%'
into a dummy service to see the type and content I get bool(false)
which proves that it is indeed a boolean false.
First of all, is this a bug? Then how can I use a parameter as shown above?
Thanks
Note: That parameter is configured in my bundle as ->booleanNode('is_lazy')->defaultTrue()->end()
.