实体拒绝删除
...
var ormPref = EntityLoad("Pref", {PrefGroup = arguments.prefGroup, Pref = arguments.pref});
writedump(ormPref);
if (isnull(ormPref)) { return false; }
if (ArrayLen(ormPref) == 0) { return false; }
for (var i = 1; i <= ArrayLen(ormPref); i++) {
EntityDelete(ormPref[i]);
EntitySave(ormPref[i]);
writeoutput("deleted");
}
ORMFlush();
writedump(ormPref);
...
实体的定义是:
<cfcomponent persistent="true">
<cfproperty name="PrefID" fieldtype="id" generator="identity">
<cfproperty name="PrefGroup">
<cfproperty name="Pref">
<cfproperty name="Value">
<cfproperty name="modifyBy">
<cfproperty name="modifyDate" generated="always">
<cfproperty name="createBy" update="false">
<cfproperty name="createDate" update="false" generated="always">
</cfcomponent>
更新
事实证明它已被删除,后来其他一些代码注意到它丢失并重新添加。所以该函数确实可以正常工作