@@ 11-26 (lines=16) @@ | ||
8 | ||
9 | class ClientController extends BaseController |
|
10 | { |
|
11 | public function indexAction() |
|
12 | { |
|
13 | $container = ContainerService::getInstance()->getContainer(); |
|
14 | ||
15 | /** @var ClientRepository $clientRepository */ |
|
16 | $clientRepository = $container['repository.Client']; |
|
17 | ||
18 | /** @var Client $user */ |
|
19 | $clients = $clientRepository->findAll(); |
|
20 | ||
21 | if (count($clients) == 0) { |
|
22 | $this->sendJsonResponse(['No clients found']); |
|
23 | } |
|
24 | ||
25 | $this->sendJsonResponse($clients); |
|
26 | } |
|
27 | } |
@@ 42-55 (lines=14) @@ | ||
39 | * ) |
|
40 | * |
|
41 | */ |
|
42 | public function indexAction() |
|
43 | { |
|
44 | $id = $this->getParam('id'); |
|
45 | ||
46 | /** @var UserService $userSvc */ |
|
47 | $userSvc = ContainerService::getInstance()->getContainer()['service.user']; |
|
48 | ||
49 | $user = $userSvc->findUserById($id); |
|
50 | if (!$user) { |
|
51 | $this->sendJsonResponse(['User not found'], 404); |
|
52 | } |
|
53 | ||
54 | $this->sendJsonObjectResponse($user); |
|
55 | } |
|
56 | ||
57 | /** |
|
58 | * Register as a new user. Gives an email link token. |