Closed racastellanosm closed 3 years ago
Hi @excelwebzone this is a small change on bundle configuration for your review.
@racastellanosm Please add some example, also if you change the enabled
wouldn't it be also good to change the other boolean parameters?
@racastellanosm Please add some example, also if you change the
enabled
wouldn't it be also good to change the other boolean parameters?
hi @excelwebzone That's right, i will push a new commit to change all booleanNode()
to scalarNode().
My use case is this:
I have a main bundle e.g 'MainExampleBundle' that use EWZrecaptchaBundle
as dependency, so in my MainExampleBundleExtension
i do a preprendExtension()
to include EWZrecaptchaBundle
in my own and teh original parameters is received via the main bundle. When symfony receives my runtime environments transforn everithing to strings, and then when i pass the main_recaptcha.enable
param to ewz_recaptcha.enable
is received like a string and fails with the error above.
My english sometimes is very bad, sorry for that :/
Abstract: Currently, if you want ti pass a runtime configuration when you use this bundle
preprended
into another app bundle, you get and scalar type error like:Invalid type for path "ewz_recaptcha.enabled". Expected boolean, but got string.
Solution: based on symfony docs, and scalarNode is a generic node type that includes boolean, so i propose a slightly change on the Configuration node type for
enabled
variable.Also, the file that use that var, doesn't have a strict type on theirs constructors (
EWZRecaptchaType, IsTrueValidator
) , so i think we don't need to enforce a boolean on config only with the scalar node we can achieve the same behavior