DbUserGroupBackend: Really clear memberships and parent relations...

...when removing a group.

refs #8826
This commit is contained in:
Johannes Meyer 2015-06-01 15:34:38 +02:00
parent 1385295e4e
commit e936c76ca9
1 changed files with 21 additions and 0 deletions

View File

@ -122,6 +122,27 @@ class DbUserGroupBackend extends DbRepository implements UserGroupBackendInterfa
parent::update($table, $bind, $filter);
}
/**
* Delete table rows, optionally limited by using a filter
*
* @param string $table
* @param Filter $filter
*/
public function delete($table, Filter $filter = null)
{
if ($table === 'group') {
parent::delete('group_membership', $filter);
$idQuery = $this->select(array('group_id'));
if ($filter !== null) {
$idQuery->applyFilter($filter);
}
$this->update('group', array('parent' => null), Filter::where('parent', $idQuery->fetchColumn()));
}
parent::delete($table, $filter);
}
/**
* Return the groups the given user is a member of
*