工作但 hidden/missing 个实体

Working but hidden/missing entities

我的 zf2 应用程序中有几个模块,它们都有自己的实体并且都在同一个连接上。

一张小图来说明情况:

-Module 1
    -Entity A
    -Entity B
-Module 2
    -Entity C
    -Entity B
(all on the same database connection)

问题是所有实体都在工作,我可以获取、更新它们等等,但有些 "invisible"。我有一些跨模块关系,它们也工作正常。

例如,当我使用 php public/index.php orm:info 命令时,模块 2 中的所有实体都不会出现,也不会出现在 Zend 开发人员工具栏中。

当我编辑实体时,我必须手动更新数据库,如 php public/index.php orm:schema-tool:update 所说 Nothing to update - your database is already in sync with the current entity metadata.

可以获取实体,它们不是 "seen" ZDT 或终端,我不知道我做错了什么。

感谢您的帮助

这通常是由于实体路径未 declared in your config 而导致的:

<?php
    return array(
        'doctrine' => array(
            'driver' => array(
                // defines an annotation driver with two paths, and names it `my_annotation_driver`
                'my_annotation_driver' => array(
                    'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
                    'cache' => 'array',
                    'paths' => array(
                        'path/to/my/entities',
                        'another/path'
                    ),
                ),

                // default metadata driver, aggregates all other drivers into a single one.
                // Override `orm_default` only if you know what you're doing
                'orm_default' => array(
                    'drivers' => array(
                        // register `my_annotation_driver` for any entity under namespace `My\Namespace`
                        'My\Namespace' => 'my_annotation_driver'
                    )
                )
            )
        )
    );