Reputation: 1721
This is my model after model->save();
[_data:protected] => Array
(
[entity_id] => 27
[created_at] => 2016-03-01 23:13:29
[updated_at] => 2016-03-01 23:13:50
[name] => 222
[value] => 222
[visibility] => 0
[field] => sponsor
[page_id] => 21
)
[_hasDataChanges:protected] =>
[_origData:protected] => Array
(
[entity_id] => 27
[created_at] => 2016-03-01 23:13:29
[updated_at] => 2016-03-01 23:13:29
[name] => 1234
[value] => 4321
[visibility] => 0
[field] =>
[page_id] => 0
)
[_idFieldName:protected] => entity_id
but on my database 'field' and 'page_id' column are not saved. This is my code for save the element:
foreach ($sponsors as $key => $value) {
$value["field"] = $field;
$value["page_id"] = $page_id;
//Mage::Log($value);
if(intval($key) < 0)
{
$a = Mage::getModel('cmsattribute/attribute');
$a->addData($value);
$a->save();
}
else
{
$a = Mage::getModel('cmsattribute/attribute')->load($key);
$a->addData($value);
$a->save();
}
Mage::Log($a);
}
where can be the problem? name & value are updated, update_ar is also updated, the other 2 field not...
Upvotes: 2
Views: 352
Reputation: 378
the field which are not stored in db was old field or have you create new. If it's new please remove all files from var/cache and try to save again.
Upvotes: 3