download92000 2017-07-31 08:37
浏览 29
已采纳

在Symfony中添加级联到doctrine注释

I need to add cascade to some columns in my existing database, but doctrine:schema:update doesn't recognize any changes within the annotations.

FROM:
/**
 * @ORM\ManyToOne(targetEntity="User")
 */
private $user;

TO:
/**
 * @ORM\ManyToOne(targetEntity="User", cascade={"persist", "remove"})
 */
private $user;

Clearing the cache didn't help at all. Any other ideas?

  • 写回答

1条回答 默认 最新

  • doukuiqian5345 2017-07-31 08:41
    关注
    * @ORM\ManyToOne(targetEntity="User", inversedBy="your_definition")
    * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?