Zend Framework:此行已标记为只读 [英] Zend Framework: This row has been marked read-only
问题描述
这是我第一次遇到这个问题.保存我的模型之一时,我收到错误消息:此行已标记为只读".不知道为什么我会收到这个错误以及如何解决它.堆栈跟踪对我没有帮助.如何解决此问题以便保存记录?
This is the first time I've come across this issue. When saving one of my models I get the error message: "This row has been marked read-only". Not sure why I'm getting this error and how to solve it. The stack trace didn't help me. How can I resolve this issue so I can save the record?
推荐答案
将一行标记为只读可能是以下任一操作的结果:
Having a row marked as read only can be the result from any of the following operations:
- 与另一个表连接的
Zend_Db_Select
查询 setIntegrityCheck(false)
已在选择对象上设置- 一列或多列是计算表达式的结果
- The
Zend_Db_Select
query joined with another table setIntegrityCheck(false)
was set on the select object- One or more columns is the result of an evaluated expression
如果上述任何一个条件为真,那么结果行对象将被标记为只读,因为 Zend_Db 不能保证结果中的所有列都引用了选择对象的原始父表.因此,对行对象调用 update()
、save()
或 delete()
的任何尝试都将失败.
If any of the above conditions are true, then the resulting row object will be marked as read only, because Zend_Db cannot guarantee that all columns in the result reference the original parent table of the select object. Therefore any attempt to call update()
, save()
, or delete()
, on the row object will fail.
其中一些信息散布在 Zend_Db_Table 参考,如果您搜索 integrity
,您可以看到许多行将被标记为只读的实例.
Some of this information is spread throughout the Zend_Db_Table reference, where if you search for integrity
you can see a number of instances where rows will be marked read only.
这篇关于Zend Framework:此行已标记为只读的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!