条令更新没有做任何事情

Doctrine update doesn't do anything

我正在尝试在两个 table 上添加 OneToMany 双向关联:CourseCertified

已经存在一对多关系,但是是单向的。

所以我修改了两个实体,使其成为双向的,并在 课程 侧添加了 属性

这是两个实体:

/**
 * Course
 *
 * @ORM\Table()
 * @ORM\Entity(repositoryClass="ME\ExamsBundle\Entity\CourseRepository")
 */
class Course    
{
 /**
  * @ORM\OneToMany(targetEntity="ME\ExamsBundle\Entity\Certified", mappedBy="course")
  * @ORM\JoinColumn(nullable=true)
  */
 private $certified;

//getters and setters...

}

/**
 * Certified
 *
 * @ORM\Table()
 * @ORM\Entity(repositoryClass="ME\ExamsBundle\Entity\CertifiedRepository")
 */
class Certified
{
/**
 * @ORM\ManyToOne(targetEntity="ME\ExamsBundle\Entity\Course", inversedBy="certified")
 * @ORM\JoinColumn(nullable=false)
 */
private $course;

// getters and setters...

}

但是当我使用命令时

    doctrine:schema:update -- dump-sql

它告诉我没有什么要更新的。

我试过了

但是属性认证从未出现在数据库中的课程table中。

我有点卡在这里,所以任何帮助将不胜感激。

提前致谢

汤姆

Doctrine 中的双向关系与 SQL 观点的单向关系没有区别:那是因为 Doctrine 可以推断反向关系,将外键与另一个 [= =18=]。在你的课程中添加一个新的列 table 将是一个非规范化的形式,或者更糟的是它没有任何意义。

Doctrine命令的响应没问题

请进一步研究数据库的规范化形式:https://en.wikipedia.org/wiki/Database_normalization