Skip to content

Clearify shorten configuration syntax #299

@wouterj

Description

@wouterj

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions