Skip to content

Register custom DQL cookbook page is misleading #2937

Closed
@jbafford

Description

@jbafford

The cookbook page on registering custom DQL functions (http://symfony.com/doc/2.2/cookbook/doctrine/custom_dql_functions.html) contains a config snippet showing how to add functions.

While it might benefit from a little more exposition, my main concern is that the sample configuration doesn't work if you apply it to the default configuration. The cookbook page suggests using

# app/config/config.yml
doctrine:
    orm:
        # ...
        entity_managers:
            default:
                # ...
                dql:
                    # … new functions here …

however, this causes an error complaining that auto_mapping is not a valid configuration parameter. (The default config sets doctrine.orm.auto_mapping: true.)

A better way (rather, a way that works with the fewest changes from the default config) to add new functions might be something along the lines of:

# app/config/config.yml
doctrine:
    orm:
        # ...
        dql:
            # … new functions here …

Before I submit a PR changing that, is there a particular reason we would want to keep the existing version of the configuration, showing specifying the configuration on a per-manager basis, or can we just omit that, and assume that someone who needs the more advanced case of creating per-manager config would know to change the configuration as appropriate?

Metadata

Metadata

Assignees

No one assigned

    Labels

    DoctrineactionableClear and specific issues ready for anyone to take them.good first issueIdeal for your first contribution! (some Symfony experience may be required)hasPRA Pull Request has already been submitted for this issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions