Skip to content
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

Clearify shorten configuration syntax #299

Closed
wouterj opened this issue Jun 15, 2014 · 5 comments
Closed

Clearify shorten configuration syntax #299

wouterj opened this issue Jun 15, 2014 · 5 comments

Comments

@wouterj
Copy link
Contributor

wouterj commented Jun 15, 2014

The shorten syntax for connections and entity_managers in the configuration is truly great. But the current implementation has a very big flawback: The error messages are not clear enough. If you are not aware that there is a shorten version, you'll have a hard time understanding code examples in documentations.

We've had a couple of issues about this in the Symfony docs lately: symfony/symfony-docs#3878, symfony/symfony-docs#3946, symfony/symfony-docs#393

Assume you have this config (which is incorrect since it uses both the expanded and shorten syntax):

doctrine:
  orm:
    auto_mapping: true
    entity_managers:
      default:
        dql: ...

You get this error message:

Unrecognized options "auto_mapping" under "doctrine.orm"

As if the auto_mapping option doesn't exists at all.

I propose to improve these error message to include that you already use the expanded version and thus it needs to be placed under the specific entity manager. For instance:

The configuration contains specific entity managers, you should move the "auto_mapping" option to a specific entity manager.

/cc @weaverryan

@stof
Copy link
Member

stof commented Jun 16, 2014

The error messages are coming from the Config component. They cannot be customized

@wouterj
Copy link
Contributor Author

wouterj commented Jun 16, 2014

We can add some custom validation and use ->invalid to override the Config component messages, can't we?

@wouterj
Copy link
Contributor Author

wouterj commented Oct 18, 2014

@wouterj
Copy link
Contributor Author

wouterj commented Oct 18, 2014

We can now also add information to the error messages using the info option.

@alcaeus
Copy link
Member

alcaeus commented Apr 12, 2019

Closing here as this can't be changed since it's the config component handling things (and because the issue hasn't been touched in more than 4 years).

@alcaeus alcaeus closed this as completed Apr 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants