accessChecker->ensureCanAccessMail($this->getUser()); $folders = $this->folderRepository->findAllOrderedByPath(); $data = array_map(static fn ($folder) => [ 'id' => $folder->getId(), 'path' => $folder->getPath(), 'displayName' => $folder->getDisplayName(), 'parentPath' => $folder->getParentPath(), 'unreadCount' => $folder->getUnreadCount(), 'totalCount' => $folder->getTotalCount(), 'lastSyncedAt' => $folder->getLastSyncedAt()?->format(DateTimeInterface::ATOM), ], $folders); return $this->json($data); } }