mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-25 19:28:51 +02:00
Refactored Admin Page controllers a bit...
This commit is contained in:
parent
e7e73602a0
commit
a8786341d5
5 changed files with 190 additions and 96 deletions
|
@ -44,6 +44,7 @@ namespace App\Controller;
|
|||
|
||||
use App\Controller\AdminPages\BaseAdminController;
|
||||
use App\Entity\Attachments\GroupAttachment;
|
||||
use App\Entity\Base\AbstractNamedDBElement;
|
||||
use App\Entity\Parameters\GroupParameter;
|
||||
use App\Entity\UserSystem\Group;
|
||||
use App\Form\AdminPages\GroupAdminForm;
|
||||
|
@ -120,4 +121,16 @@ class GroupController extends BaseAdminController
|
|||
{
|
||||
return $this->_exportEntity($entity, $exporter, $request);
|
||||
}
|
||||
|
||||
public function deleteCheck(AbstractNamedDBElement $entity): bool
|
||||
{
|
||||
if ($entity instanceof Group) {
|
||||
if ($entity->getUsers()->count() > 0) {
|
||||
$this->addFlash('error', 'entity.delete.must_not_contain_users');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue