Thursday, October 2, 2008

Update problem in AclBehavior

When adding a record in a Model that acts as AclBehavior everything
works fine and a new record is created in the Aro/Aco table linked to
the previous one.

But when I update that same record and change the alias or the parent
the Arco/Aco record is not updated.
I have check the code and the <i>afterSave</i> method is only
implemented for inserts and not updates:

function afterSave(&$model, $created) {
if ($created) {
$type = $this->__typeMaps[strtolower($this->settings[$model->name]
['type'])];
$parent = $model->parentNode();
if (!empty($parent)) {
$parent = $this->node($model, $parent);
} else {
$parent = null;
}

$model->{$type}->create();
$model->{$type}->save(array(
'parent_id' => Set::extract($parent, "0.{$type}.id"),
'model' => $model->name,
'foreign_key' => $model->id
));
}
}

There's something missing in the implementation or is suppose to be
like that?
Because the update would handy ...

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: