CakePHP 3.0.0 级联依赖删除

CakePHP 3.0.0 cascade dependent deletes

如果我在某些型号中有以下 tables; As、Bs、Cs 和 Ds。

他们定义了这些关联:

AsTable:

$this->hasOne('Bs', [
  'dependent' => true,
  'cascadeCallbacks' => true,
]);

BsTable:

$this->belongsTo('As', [
  'foreignKey' => 'A_id',
]);
$this->hasMany('Cs', [
  'foreignKey' => 'B_id',
  'dependent' => true,
  'cascadeCallbacks' => true,
]);

CsTable:

$this->belongsTo('Bs', [
  'foreignKey' => 'B_id',
]);
$this->hasMany('Ds', [
  'foreignKey' => 'C_id',
  'dependent' => true,
  'cascadeCallbacks' => true,
]);

DsTable:

$this->belongsTo('Cs', [
  'foreignKey' => 'C_id',
]);

删除 A 现在会删除 A、B 和任何链接的 C,但 D 会保留。

删除 C 会导致删除链接的 D。

为什么删除 A 不会同时删除链接到已删除 C 的 D?

我怎样才能做到这一点?

编辑: Cake 精确版本 3.0.0

查看 debugkit sql 日志中的 SQL 似乎顺序对我来说是错误的。

select from Bs where A_id = a_id (finds record with id "b_id")
delete from Cs where B_id = b_id 
select from Cs where B_id = b_id 
delete from Bs where id = b_id 
delete from A where id = a_id

(为了可读性替换了 table 名称和 ID)

根本不接触 D,显然因为它在选择之前从 Cs 中删除,所以永远不会获得能够在 D 中找到任何内容的 ID。

一头雾水!

尝试将 CakePHP 安装升级到最新的 3.0 稳定版本