src/Controller/Backend/CampaignController.php line 24

Open in your IDE?
  1. <?php
  2. namespace App\Controller\Backend;
  3. use Symfony\Component\HttpFoundation\Request;
  4. use Symfony\Component\HttpFoundation\Response;
  5. use FOS\RestBundle\Controller\Annotations as Rest;
  6. use FOS\RestBundle\View\View;
  7. use App\Annotation\Log;
  8. use App\Annotation\PermissionAdmin;
  9. use App\Annotation\PermissionPublic;
  10. /**
  11.  * @Rest\Route("/api/campaign")
  12.  */
  13. class CampaignController extends BaseController
  14. {
  15.     /**
  16.      * @Rest\Get("/list")
  17.      * @PermissionPublic
  18.      * @return View
  19.      */
  20.     public function getList(Request $request): View
  21.     {
  22.         return View::create(
  23.             $this->currentRepo->getList($requestnull),
  24.             Response::HTTP_OK
  25.         );
  26.     }
  27.     /**
  28.      * @Rest\Post("")
  29.      * @PermissionAdmin
  30.      * @Log
  31.      * @return View
  32.      */
  33.     public function add(Request $request): View
  34.     {
  35.         return View::create($this->currentService->add($request), Response::HTTP_OK);
  36.     }
  37.     /**
  38.      * @Rest\Post("/update")
  39.      * @PermissionAdmin
  40.      * @Log
  41.      * @return View
  42.      */
  43.     public function update(Request $request): View
  44.     {
  45.         return View::create($this->currentService->update(null$request), Response::HTTP_OK);
  46.     }
  47.     /**
  48.      * @Rest\Delete("/{id}")
  49.      * @PermissionAdmin
  50.      * @Log
  51.      * @return View
  52.      */
  53.     public function delete(int $id): View
  54.     {
  55.         return View::create(['result' => $this->currentService->delete($id)], Response::HTTP_OK);
  56.     }
  57.     /**
  58.      * @Rest\Get("/{id}")
  59.      * @PermissionPublic
  60.      * @return View
  61.      */
  62.     public function getOne($id): View
  63.     {
  64.         return View::create($this->currentService->getById($id), Response::HTTP_OK);
  65.     }
  66. }