编辑: 我了解到,我的子类缺少一个注释('这里它只是一个ID',而不是GreenLeaf)。 我现在的实际问题是,我不知道,如何覆盖它,我无法让它发挥作用。
原件:
我刚刚将Symfony 2.0应用程序迁移到Symfony 2.2并在dev-profiler中获得了关于单向一对多关联的“无效实体”信息。使用控制台时
php console doctrine:schema:validate
我收到2条消息:
* The association \Entity\Watched#reference refers to the inverse side field \Entity\Reference#id which is not defined as association.
* The association \Entity\Watched#reference refers to the inverse side field \Entity\Reference#id which does not exist.
我认为,这是错误的,因为'id'是在超类中定义的。应用程序仍然可以在旧数据库上运行(使用Symfony 2.0创建)。 这是我的课程(简化):
代码:全选
/**
* @ORM\MappedSuperclass
* @ORM\HasLifecycleCallbacks
*/
abstract class SuperclassAbstract {
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id = "";
// some fields more...
}
/**
* @ORM\Entity
* @ORM\Table(name="watched")
*/
class Watched extends SuperclassAbstract {
/**
* @ORM\ManyToOne(targetEntity="Reference", inversedBy="id")
* @ORM\JoinColumn(name="reference_id", referencedColumnName="id")
*/
protected $reference;
// some fields more...
}
/**
* @ORM\Entity
* @ORM\Table(name="reference")
*/
class Reference extends SuperclassAbstract {
// some fields more...
}
答案 0 :(得分:0)
我绝不能将学说视为关系数据库....谢谢!
我向Reference添加一个列表来处理关联的另一面。