dongmin1166 2014-12-22 19:50
浏览 41
已采纳

使用Doctrine 2 ORM找不到目标实体

In a ZF2 project, I have a "product" entity with this property definition :

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

And a Stock entity with this property :

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

When I call ./vendor/doctrine/doctrine-module/bin/doctrine-module orm:schema-tool:create I have this error :

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

Before, the stock entity was in the Admin\Entity\Product namespace but I moved it and changed the namespace definition.

Don't understand... Any help would be munch appreciate

  • 写回答

1条回答 默认 最新

  • dongzhan9100 2015-01-05 12:05
    关注

    I found the solution ...

    On the production server, doctrine is configured with memcache ...

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

    To flush the cache :

    telnet localhost 11211
    

    and type flush_all

    Hope it will help someone

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 shape_predictor_68_face_landmarks.dat
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制