【问题标题】:Doctrine: "1/1ReflectionException: Property Power\SelfBundle\Entity\Check::$part1 does not exists"教义:“1/1ReflectionException:Property Power\SelfBundle\Entity\Check::$part1 不存在”
【发布时间】:2014-07-31 20:47:29
【问题描述】:

我正在使用 symfony。我有一个实体Check。它有一个关系字段part

定义类似于:

/** @ORM\OneToMany(targetEntity="Power\SelfBundle\Entity\Friends", mappedBy="check")*/
protected $part1;

在反向关系中(Friendsentity),声明如下:

/** @ORM\ManyToOne(targetEntity="Power\SelfBundle\Entity\Check", inversedBy="part1") */
public $check;

现在为了消除歧义,我删除了该字段并将其替换为part。我已经更新了架构并清除了缓存和日志。

稍后我将插入朋友实体(实际上是表),它在事件调用实体时出错:

1/1ReflectionException: Property Power\SelfBundle\Entity\Check::$part1 does not exists

但是 $part1 早就被删除了。 cache 被清除,log 也被清除。我已经搜索了整个项目,但甚至找不到文本 part1

我没脑子!!

谁能帮帮我!!

谢谢。

【问题讨论】:

  • 你应该把当前的实体代码贴出来,这样我们可以看看有没有错误。
  • @Lighthart - 好的!如果这是相关的 - 我在这里发布代码。
  • 您确定inversedBy 声明也已更改为“部分”?不仅仅是字段名称。
  • @DebreczeniAndrás,是的,我已经重新检查过了。我正在用我的整个实体代码更新问题。
  • 很好。 APC 非常棘手。接受您的答案,以便其他人找到它。

标签: symfony doctrine-orm fatal-error


【解决方案1】:

经过大量研究,问题已解决。

问题出在学说元数据缓存中。

在我的config.yml 文件中,metadata_cache_driver 被设置为使用 APC。所以清除教义app/cache 并没有帮助。

经过大量搜索 - 我已经完成了

php -r "apc_clear_cache(); apc_clear_cache('user'); apc_clear_cache('opcode');"

BINGO 成功了!!

所以在我的config_dev.yml 中,我已经覆盖了将metadata_cache_driver 设置为数组的设置。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-03-11
    • 2020-06-25
    • 1970-01-01
    • 2018-07-11
    • 1970-01-01
    • 1970-01-01
    • 2017-01-12
    相关资源
    最近更新 更多