user2143356
user2143356

Reputation: 5607

Can I place a Doctrine2 ORM config file in a different location - Symfony2

I can't get this to work, so not sure if it is possible.

I want to place a Doctrine2's entity_name.orm.yml config file in a different location to the default ({bundle}/resources/config/doctrine).

Is this possible?

Ideally I could just specify a location.

Even better I could specify some config data in the default file location and also specify additional in a second config file, in a different location.

I know other Symfony2 config files can be done like this, but I can't get this to work with Doctrine/Symfony2

Upvotes: 0

Views: 283

Answers (2)

Igor Pantović
Igor Pantović

Reputation: 9246

Yes you can, you just need to tell doctrine where to look for them:

doctrine
    orm:
        # your entity manager name here
        default:
            mappings:
                # An array of mappings, which may be a bundle name or something else
                mapping_name:
                    mapping:              true
                    type:                 ~
                    dir:                  ~
                    alias:                ~
                    prefix:               ~
                    is_bundle:            ~

See Doctrine Mapping Configuration Reference for details on each of these options.

Upvotes: 2

Paul Andrieux
Paul Andrieux

Reputation: 1847

You can use imports in your config.yml:

imports:
- { resource: doctrine.yml }

Upvotes: 0

Related Questions