mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-30 11:33:49 +00:00
Allow the selection of multiple centers to create multiple groupcenters at once
This commit is contained in:
@@ -64,10 +64,19 @@ class UserController extends CRUDController
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isValid()) {
|
||||
$groupCenter = $this->getPersistedGroupCenter(
|
||||
$form[self::FORM_GROUP_CENTER_COMPOSED]->getData()
|
||||
);
|
||||
$user->addGroupCenter($groupCenter);
|
||||
|
||||
$formData = $form[self::FORM_GROUP_CENTER_COMPOSED]->getData();
|
||||
$selectedCenters = $formData['center'];
|
||||
|
||||
foreach ($selectedCenters as $center) {
|
||||
$groupCenter = new GroupCenter();
|
||||
$groupCenter->setCenter($center);
|
||||
$groupCenter->setPermissionsGroup($formData['permissionsgroup']);
|
||||
|
||||
$user->addGroupCenter($groupCenter);
|
||||
|
||||
$em->persist($groupCenter);
|
||||
}
|
||||
|
||||
if (0 === $this->validator->validate($user)->count()) {
|
||||
$em->flush();
|
||||
|
Reference in New Issue
Block a user