/** * @Route("/csv_users") * @Method({"GET"}) * * @return array */ public function csv_users() { if (!$this->isAdmin()) { return ['error' => true, 'errorText' => 'accessDenied']; } $users = $this->authorservice->get_all(); $result = ''; foreach ($users as $user) { $data = [$user['id'], $user['name'], $user['email'], $user['date_reg'], 'reg_from' => $user['reg_from']]; $result .= implode(',', $data) . "\n"; } return ['result' => $result]; }