vendor/launchpad/backend/src/Admin/Api/Controller/AccountController.php line 16

Open in your IDE?
  1. <?php
  2. namespace LaunchPad\Bundle\LaunchPadBundle\Admin\Api\Controller;
  3. use LaunchPad\Bundle\LaunchPadBundle\Admin\Api\Request\Account\InitializeAccountRequest;
  4. use LaunchPad\Bundle\LaunchPadBundle\Base\Entity\Account\Account;
  5. use LaunchPad\Bundle\LaunchPadBundle\Base\Service\AccountService;
  6. use LaunchPad\Bundle\LaunchPadBundle\Base\Service\UserService;
  7. use Symfony\Component\Routing\Annotation\Route;
  8. /**
  9.  * Class PaymentDeviceController
  10.  * @package BoBoFin\Admin\Api\Controller
  11.  * @Route("/account", name="admin_account_")
  12.  */
  13. class AccountController extends BaseAdminApiController
  14. {
  15.     /**
  16.      * @Route("/list", name="list")
  17.      * @return \Symfony\Component\HttpFoundation\JsonResponse
  18.      * @throws \Doctrine\Common\Annotations\AnnotationException
  19.      * @throws \Symfony\Component\Serializer\Exception\ExceptionInterface
  20.      */
  21.     public function getAccountListAction()
  22.     {
  23.         $list $this->paginatorService->getPaginated(
  24.             Account::class,
  25.             $this->data
  26.         );
  27.         return $this->success($listnull, ['account_data''basic_data']);
  28.     }
  29.     /**
  30.      * @Route("/initialize", name="initialize")
  31.      * @param UserService $userService
  32.      * @param AccountService $accountService
  33.      * @return \Symfony\Component\HttpFoundation\JsonResponse
  34.      * @throws \Doctrine\Common\Annotations\AnnotationException
  35.      * @throws \LaunchPad\Bundle\LaunchPadBundle\Base\Exception\MissingApiParamsException
  36.      * @throws \Symfony\Component\Serializer\Exception\ExceptionInterface
  37.      */
  38.     public function initializeAction(UserService $userServiceAccountService $accountService)
  39.     {
  40.         $request $this->validateRequest(InitializeAccountRequest::class);
  41.         $user $userService->getUserById($request->id);
  42.         if(!$user) return $this->failure('User not found');
  43.         $accountService->userCreated($user);
  44.         return $this->success();
  45.     }
  46. }