Skip to content
Snippets Groups Projects
Commit 596fa533 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

delete app: delete its users first

parent 1169ad78
No related branches found
No related tags found
1 merge request!42Imporove logging
......@@ -25,4 +25,27 @@ class objwebapps extends axelhahn\pdo_db_base
{
parent::__construct(__CLASS__, $oDB);
}
/**
* Hook for delete() method
* Delete all related appusers first
* It returns false one of the users was not deleted.
*
* @return bool
*/
protected function hookDelete(): bool
{
global $oDB;
require 'webusers.php';
$oWebusers = new objwebusers($oDB);
$aUsers=$oWebusers->search(['columns' => 'id', 'where' => ['appid' => $this->id()]]);
foreach($aUsers as $aUser){
if(!$oWebusers->delete($aUser['id'])){
return false;
}
}
return true;
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment