Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 848
Andrew Avatar asked Apr 27 '12 17:04

Andrew


1 Answers

Having a row marked as read only can be the result from any of the following operations:

  • 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

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.

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.

like image 156
drew010 Avatar answered Nov 08 '22 04:11

drew010