Deleting attributes deletes associated shadow attributes

There was a bug causing "zombie" shadowattributes to stay in events if the attribute has been deleted
pull/195/head
iglocska 2013-09-04 08:52:30 +02:00
parent 9f3dadfadf
commit 807cc4c090
1 changed files with 4 additions and 1 deletions

View File

@ -778,7 +778,10 @@ class AttributesController extends AppController {
// find the uuid
$this->__deleteAttributeFromServers($uuid);
}
// We have just deleted the attribute, let's also check if there are any shadow attributes that were attached to it and delete them
$this->loadModel('ShadowAttribute');
$this->ShadowAttribute->deleteAll(array('ShadowAttribute.old_id' => $id), false);
$this->Session->setFlash(__('Attribute deleted'));
} else {
$this->Session->setFlash(__('Attribute was not deleted'));