使用原则 2 ORM 找不到目标实体


Target entity not found using Doctrine 2 ORM

在 ZF2 项目中,我有一个具有此属性定义的"产品"实体:

/**
 * @ORM'OneToMany(targetEntity="Admin'Entity'Stock'Stock", mappedBy="product", cascade={"persist", "merge", "remove"})
 **/
protected $stocks;

以及具有此属性的股票实体:

/**
 *
 * @ORM'ManyToOne(targetEntity="Admin'Entity'Product'Product", inversedBy="stocks", cascade={"persist", "merge"})
 */
protected $product;

当我打电话给./vendor/doctrine/doctrine-module/bin/doctrine-module orm:schema-tool:create我有这个错误:

[Doctrine'ORM'Mapping'MappingException]                                                                     
The target-entity Admin'Entity'Product'Stock cannot be found in 'Admin'Entity'Product'Product#stocks'.

以前,股票实体位于 Admin'Entity'Product 命名空间中,但我移动了它并更改了命名空间定义。

不理解。。。任何帮助将不胜感激

我找到了解决方案...

在生产服务器上,学说配置了内存缓存...

'driver' =>
        [
            'sympass_annotation_driver'    =>
                [
                    'cache' => 'memcached',
                ],
            'accounting_annotation_driver' =>
                [
                    'cache' => 'memcached',
                ],
            'admin_administrative_annotation_driver' =>
                [
                    'cache' => 'memcached',
                ],
        ],

要刷新缓存:

telnet localhost 11211

并键入 flush_all

希望它能帮助某人