【问题标题】:Symfony Mapping Error: "The association Entity\Rule#ruleSettings refers to the owning side field Entity\RuleSettings#rules which does not exist."Symfony 映射错误:“关联 Entity\Rule#ruleSettings 引用了不存在的拥有方字段 Entity\RuleSettings#rules。”
【发布时间】:2023-03-25 09:16:01
【问题描述】:

我会问我为什么会出错

 [FAIL] The entity-class AppBundle\Entity\Rule mapping is invalid:
 * The association AppBundle\Entity\Rule#ruleSettings refers to the owning side field AppBundle\Entity\RuleSettings#rules which does not exist.

 [FAIL] The entity-class AppBundle\Entity\RuleSettings mapping is invalid:
 * The association AppBundle\Entity\RuleSettings#targets refers to the inverse side field AppBundle\Entity\Target#rulesettings which does not exist.
 * The association AppBundle\Entity\RuleSettings#departments refers to the inverse side field AppBundle\Entity\Department#rulesettings which does not exist.
 * The association AppBundle\Entity\RuleSettings#ruleActions refers to the owning side field AppBundle\Entity\RuleAction#rulesettings which does not exist.

 ...

当我打电话时

console  doctrine:schema:validate

有我的实体: 规则

 /**
     * @ORM\OneToMany(targetEntity="RuleSettings",mappedBy="rules")
     */
    private $ruleSettings;

规则设置

  /**
     * @ORM\ManyToOne(targetEntity="Rule")
     * @ORM\JoinColumn(name="ruleId",nullable=false)
     */
    private $rule;

我有什么问题?

【问题讨论】:

    标签: symfony orm doctrine-orm doctrine-mapping symfony-4.4


    【解决方案1】:

    mappedBy="rules" 不等于 $rule

    更改为mappedBy="rule"

    【讨论】:

      猜你喜欢
      • 2016-11-09
      • 1970-01-01
      • 1970-01-01
      • 2011-07-14
      • 2014-02-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-18
      相关资源
      最近更新 更多