Refactored Admin Page controllers a bit...

This commit is contained in:
Jan Böhmer 2020-06-07 21:11:09 +02:00
parent e7e73602a0
commit a8786341d5
5 changed files with 190 additions and 96 deletions

View file

@ -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;
}
}