【发布时间】:2014-05-20 09:44:32
【问题描述】:
我正在使用 Doctrine 2.4.2、Symfony 2.4 和 SQLite 3.8.3。
我定义了两个实体:
Category:
type: entity
id:
id:
type: integer
id: true
generator:
strategy: AUTO
oneToMany:
ministries:
targetEntity: Ministry
cascade: [persist]
mappedBy: category
和
Ministry:
type: entity
id:
id:
type: integer
id: true
generator:
strategy: AUTO
manyToOne:
category:
targetEntity: Category
inversedBy: ministries
joinColumn:
name: category_id
nullable: false
onDelete: CASCADE
但是当我删除一个类别时,部门实体不会被删除,尽管约束应该级联。我错过了什么?
我是否必须进行任何配置才能使其正常工作?
【问题讨论】:
-
找到解决方案,redirect to answer
标签: php sqlite symfony doctrine-orm