R
R
roman_lyce2014-09-24 11:02:01
Doctrine ORM
roman_lyce, 2014-09-24 11:02:01

How to properly connect Doctrine in ZF2?

The structure of the application is:
module/
....Application/
........src/
............Application/
.............. ..Entity/
....MyModule/
........src/
............MyModule/
................ Entity/
[...]
As a result, only those entities that are in Application, but not in MyModule, are seen. Of course, I rewrite config.module.php configs for the corresponding module. This is how it should be, or is it still possible to put entities into MyModule?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Shirshov Alexander, 2014-10-22
@Keanor

We have in each module exactly those entities that "belong" to this module. The only thing needed for this is: config.module.php
Show your config, how you tell doctrine where to look for entities. Here is my example from working code:

'doctrine' => array (
        'driver' => array(
            'catalog_entities' => array(
                'class' =>'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
                'cache' => 'array',
                'paths' => array(__DIR__ . '/../src/Catalog/Entity')
            ),

            'orm_default' => array(
                'drivers' => array(
                    'Catalog\Entity' => 'catalog_entities'
                ),
            ),
        ),
    ),

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question