New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable / disable form in configuration #24269

Closed
steevanb opened this Issue Sep 20, 2017 · 7 comments

Comments

Projects
None yet
4 participants
@steevanb

steevanb commented Sep 20, 2017

Q A
Bug report? yes
Feature request? no
BC Break report? yes
RFC? no
Symfony version 3.3.*

Hi !

In app/config/config.yml, this 2 configurations should have same behavior :

framework:
    form: ~
framework:
    # no form key

But first one enable form, and second one, disable it (framework.form.enabled default value is false : https://symfony.com/doc/current/reference/configuration/framework.html#reference-form-enabled)

Or maybe ~ is not exactly same as "default values" ?
In this case, how can we know differences between ~ and default values ?

@chalasr

This comment has been minimized.

Member

chalasr commented Sep 20, 2017

This is a documentation issue, as of 3.3 the framework.form.enabled config option is default true if you are requiring symfony/symfony.

@chalasr

This comment has been minimized.

Member

chalasr commented Sep 20, 2017

@chalasr chalasr closed this Sep 20, 2017

@steevanb

This comment has been minimized.

steevanb commented Sep 20, 2017

So, i don't understand why form: ~ and no form key does not have same behavior ?

@chalasr

This comment has been minimized.

Member

chalasr commented Sep 20, 2017

Just tried out, not adding the form key at all gives enabled: false at end. ping @ogizanagi

@chalasr chalasr reopened this Sep 20, 2017

@steevanb

This comment has been minimized.

steevanb commented Sep 20, 2017

When i dump Configuration object, i have 2 properties : $defaultValue = false, and $default = true.

I'm not sure about it, but maybe when you define form key, default value is readed in $default, not $defaultValue ?

@ogizanagi

This comment has been minimized.

Member

ogizanagi commented Sep 20, 2017

If you're using the fullstack (symfony/symfony), the framework.form node is built using canBeEnabled (for BC reasons, as the original way before the framework Configuration object was tweaked in #21196 was to have everything disabled by default).

So

framework:
    form: ~

is not the same as

framework:
    # no form key

because canBeEnabled treats null as ['enabled' => true]. The ~ char in yaml does not mean "take default values". It's just null. What is really configured behind depends on the way the node was built.

#21196 changed the framework Configuration object for Flex projects in order to cleverly auto-enable available features according to the components you've installed. So given you're using flex in your project instead of the fullstack and have the symfony/form component installed, canBeDisabled is used, which means no framework.form key is even required, as it defaults to ['enabled' => true] when not set.

So in conclusion, I see no issue here, unless I missed something.

Thanks for opening this though. We should probably upgrade the documentation to explain how defaults behaves with Flex. symfony/symfony-docs#8412 will be a good start.

@ogizanagi ogizanagi closed this Sep 20, 2017

@steevanb

This comment has been minimized.

steevanb commented Oct 17, 2017

Ok, to me, that's a bug.

But if you don't think so ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment