Save fails when updating and ignoreEmptyValuesOnUpdate set to false
GoogleCodeExporter opened this issue · comments
Google Code Exporter commented
If you try to save an object which has a non-zero primary key and you've
passed in a value of false for ignoreEmptyValuesOnUpdate then the object
won't be updated at all.
This is seen in the save() function of the Mapper.tpl file. It looks like
lines 141 and 142 could just be swapped around. Although, since $data is
required which ever route the code takes, I don't see why you can't just
put "$data = $cls->toArray();" as the first line of the function and then
remove all references to it elsewhere in the function.
Thanks,
James.
Original issue reported on code.google.com by j...@james-thomson.net
on 3 Apr 2010 at 4:52
Google Code Exporter commented
thanks for the feedback. checking this issue.
Original comment by kfirufk@gmail.com
on 10 Apr 2010 at 4:03
Google Code Exporter commented
Modify templates/mapper.tpl toArray() function as follows
public function toArray($cls) {
<?foreach ($this->_columns as $column):?>if($cls->get<?=$column['capital']?>() !== null) $result['<?=$column['field']?>'] = $cls->get<?=$column['capital']?>();
<?endforeach;?>
return $result;
}
Find attachment for updated mapper.tpl file
Original comment by naseemka...@gmail.com
on 28 Jun 2011 at 11:16
Attachments: