implement clean deletion of Seminaries

This commit is contained in:
oliver 2015-08-16 21:27:36 +02:00
commit 60b7f12f79
25 changed files with 410 additions and 9 deletions

View file

@ -20,6 +20,12 @@
*/
class CharactergroupsModel extends \hhu\z\Model
{
/**
* Required models
*
* @var array
*/
public $models = array('charactergroupsquests');
@ -225,6 +231,31 @@
}
/**
* Delete all Character groups-groups of a Seminary.
*
* @param int $seminaryId ID of Seminary to delete Character groups-groups of
*/
public function deleteGroupsgroupsOfSeminary($seminaryId)
{
// Get Groupsgroups
$charactergroupsgroups = $this->getGroupsroupsForSeminary($seminaryId);
// Delete each Groupsgroup
foreach($charactergroupsgroups as $groupsgroup)
{
// Delete Groups
$this->deleteGroupsOfGroupsgroup($groupsgroup['id']);
// Delete Groupsquests
$this->Charactergroupsquests->deleteQuestsOfGroupsgroup($groupsgroup['id']);
// Delete Groupsgroup
$this->db->query('DELETE FROM charactergroupsgroups WHERE seminary_id = ?', 'i', $seminaryId);
}
}
/**
* Get Character groups for a Character groups-group.
*
@ -475,6 +506,17 @@
}
/**
* Delete all Character groups of a groups-group.
*
* @param int $groupsgroupId ID of Character groups-group to delete groups of
*/
public function deleteGroupsOfGroupsgroup($groupsgroupId)
{
$this->db->query('DELETE FROM charactergroups WHERE charactergroupsgroup_id = ?', 'i', $groupsgroupId);
}
/**
* Get the rank of a XP-value of a Character.
*