src/Controller/CompanyController.php line 21

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Api\BrcBackend\DTO\CityProfilesList;
  4. use App\Api\BrcBackend\DTO\Profile;
  5. use App\Api\BrcBackend\DTO\ProfilesList;
  6. use App\Form\SearchType;
  7. use App\Service\Paginator\PaginatorBuilder;
  8. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  9. use Symfony\Component\HttpFoundation\Response;
  10. use Symfony\Component\Routing\Annotation\Route;
  11. final class CompanyController extends AbstractController
  12. {
  13.     /**
  14.      * @Route("/company/list/{page}", name="company_list", defaults={"page"=null}, methods={"GET"})
  15.      *
  16.      * @throws \Throwable
  17.      */
  18.     public function list(ProfilesList $profilesPaginatorBuilder $paginator): Response
  19.     {
  20.         return $this->render('company/list.html.twig', [
  21.             'profiles' => $profiles->getProfiles(),
  22.             'pagination' => $paginator->build($profiles->getPage(), $profiles->getTotalPages()),
  23.             'currentPage' => $profiles->getPage(),
  24.             'form' => $this->createForm(SearchType::class)->createView(),
  25.         ]);
  26.     }
  27.     /**
  28.      * @Route("/city/{id}-{slug}/companies/{page}", name="city_companies_list", defaults={"page"=null}, methods={"GET"})
  29.      */
  30.     public function getCityCompaniesList(CityProfilesList $listPaginatorBuilder $paginator): Response
  31.     {
  32.         return $this->render('company/city_companies_list.html.twig', [
  33.             'profiles' => $list->getProfiles(),
  34.             'city' => $list->getCity(),
  35.             'pagination' => $paginator->build($list->getPage(), $list->getTotalPages()),
  36.             'currentPage' => $list->getPage(),
  37.             'form' => $this->createForm(SearchType::class)->createView(),
  38.         ]);
  39.     }
  40.     /**
  41.      * @Route("/company/{id}-{slug}", name="company_show", methods={"GET"})
  42.      */
  43.     public function show(Profile $profile): Response
  44.     {
  45.         return $this->render('company/show.html.twig', ['profile' => $profile]);
  46.     }
  47. }