Fakhar Anwar
Fakhar Anwar

Reputation: 295

Zend Framework, Doctrine, Entities Setting Configuration on Module (Level) Configuration?

Reference: Heading "Entities Settings" on the link below https://github.com/doctrine/DoctrineORMModule#entities-settings

tells to register configurations on module (merged) configuration. However in order to use doctrine from more than one modules, if i use same configuration keys like ;

'paths' => [
    'path/to/my/entities',
    'another/path',
],

'orm_default' => [
    'drivers' => [
     // ...

will not the other module overwrite the array as values of keys? (yielding the effect as only last module configured to use ORM / Entities).

If the answer is yes then should not we define the configuration in autoload/global.php ?

Upvotes: 0

Views: 86

Answers (1)

gsc
gsc

Reputation: 1559

No, configuration of all modules in ZF is “losslessly” merged, not overwritten by the last one.

For example, if you put the following in TheFirstModule’s config:

'paths' => [__DIR__ . '/../src/Entity/']

and the following in TheSecondModule’s config:

'paths' => [__DIR__ . '/../src/Entity/']

the merged configuration will look like this:

'paths' => [
    '…/module/TheFirstModule/src/Entity/',
    '…/module/TheSecondModule/src/Entity/'
]

Upvotes: 0

Related Questions