且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

CakePHP - 删除级联不工作

更新时间:2023-02-03 08:11:39

我不认为你可以删除Type with SpecificType cascade。你只能使用级联,如果有多个或HABTM关系。

I don't think you can delete Type with SpecificType cascade. you can only use cascade if there's hasMany or HABTM relation.

它在手册中说。



删除由$ id标识的记录。默认情况下,还删除依赖于指定给
的记录的记录

Deletes the record identified by $id. By default, also deletes records dependent on the record specified to be deleted.

删除与许多Recipe
记录(用户'hasMany'或
'hasAndBelongsToMany'Recipes)绑定的用户
记录:

For example, when deleting a User record that is tied to many Recipe records (User 'hasMany' or 'hasAndBelongsToMany' Recipes):

* if $cascade is set to true, the related Recipe records are also



如果模型依赖值
设置为true,则会删除


*如果$ cascade设置为false,配方记录将保留在
用户被删除后。

deleted if the models dependent-value is set to true. * if $cascade is set to false, the Recipe records will remain after the User has been deleted.

您随时可以执行

$this->del($id, true);

删除与相关SpecificType类型。

to remove your Type with related SpecificType-s.