【问题标题】:Working but hidden/missing entities工作但隐藏/缺失的实体
【发布时间】:2015-07-08 15:28:47
【问题描述】:

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

一张小图说明情况:

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

问题是所有实体都在工作,我可以获取、更新它们等,但有些是“不可见的”。我有一些跨模块的关系,它们也工作得很好。

例如,当我使用 php public/index.php orm:info 命令或 Zend Developer Toolbar 时,模块 2 中的所有实体都不会出现。

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

可以获取实体,只是 ZDT 和终端都没有“看到”它们,我不知道我做错了什么。

感谢您的帮助

【问题讨论】:

    标签: doctrine-orm zend-framework2


    【解决方案1】:

    这通常是当实体的路径不是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'
                        )
                    )
                )
            )
        );
    

    【讨论】:

    • 我将my_annotation_driver 的等效项更改为(从bm_entityapplication_entity)并且它起作用了,也许是与其他模块的冲突
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-02-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-12-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多