This commit is contained in:
Charles 2025-10-14 09:34:09 +02:00
parent 6e6d02e658
commit e818a17371
1 changed files with 12 additions and 11 deletions

View File

@ -43,17 +43,7 @@ class OrganizationController extends AbstractController
if ($this->isGranted("ROLE_SUPER_ADMIN")) {
$organizations = $this->entityManager->getRepository(Organizations::class)->findBy(['isDeleted' => false]);
// Map the entities for tabulator
$organizationsData = array_map(function($org) {
return [
'id' => $org->getId(),
'name' => $org->getName(),
'email' => $org->getEmail(),
'logoUrl' => $org->getLogoUrl() ? $org->getLogoUrl() : null, // or prepend base URL if needed
'active' => $org->isActive(),
'showUrl' => $this->generateUrl('organization_show', ['id' => $org->getId()]),
];
}, $organizations);
} else {
//get all the UO of the user
$uos = $this->entityManager->getRepository(UsersOrganizations::class)->findBy(['users' => $user]);
@ -70,6 +60,17 @@ class OrganizationController extends AbstractController
}
}
// Map the entities for tabulator
$organizationsData = array_map(function($org) {
return [
'id' => $org->getId(),
'name' => $org->getName(),
'email' => $org->getEmail(),
'logoUrl' => $org->getLogoUrl() ? $org->getLogoUrl() : null, // or prepend base URL if needed
'active' => $org->isActive(),
'showUrl' => $this->generateUrl('organization_show', ['id' => $org->getId()]),
];
}, $organizations);
return $this->render('organization/index.html.twig', [
'organizationsData' => $organizationsData,
]);