What causes a row (Zend_Db_Table_Row
) to be set to "readOnly
?" I'm having trouble deleting rows in a loop:
// this is set to some integers
$ids = array();
// get the results
$results = $table->fetchAll($select);
foreach ($results as $result)
{
$value = $result->value;
if (!in_array($value, $ids))
{
// throws a "row is read-only" error
$result->delete();
}
}
I want to delete the row's that aren't in the $ids array, but it throws an error saying the row is read only. I haven't set that flag or done anything with the row...any idea why it's read-only? Any help would be appreciated.
EDIT:
Here's my select:
$table = $options->joinModel;
$select = $table->select();
$select->from($table->getTableName(), array("id", "value" => $options->joinForeignKey))
->where("`{$options->foreignKey}` = ?", $row->id)
->group($options->joinForeignKey);