src/Horse/Controller/HorseTabNavigationController.php line 58

Open in your IDE?
  1. <?php
  2. namespace App\Horse\Controller;
  3. use App\Network\Service\NetworkHorseService;
  4. use App\Profile\Service\ProfileService;
  5. use Pimcore\Controller\FrontendController;
  6. use Pimcore\Model\DataObject\Horse;
  7. use Symfony\Component\HttpFoundation\Request;
  8. use Symfony\Component\HttpFoundation\Response;
  9. use Symfony\Component\Routing\Annotation\Route;
  10. #[Route([
  11.   'name' => 'horse_tab_navigation_',
  12.   'localizedPaths' => [
  13.     'en' => '/{_locale}/horse/tabnav',
  14.     'de' => '/{_locale}/horse/tabnav',
  15.     'fr' => '/{_locale}/horse/tabnav',
  16.   ],
  17. ])]
  18. class HorseTabNavigationController extends FrontendController
  19. {
  20.   #[Route('/{id}/timeline'name'timeline')]
  21.   public function timeline(Request $request$id): Response
  22.   {
  23.     $request->setRequestFormat('text/html');
  24.     return $this->renderForm('network/horse/sections/horse_section_timeline.html.twig', [
  25.       'user' => $this->getUser(),
  26.       'horse' => Horse::getById($id),
  27.     ]);
  28.   }
  29.   #[Route('/{id}/auction-history'name'auction_history')]
  30.   public function auctionHistory(Request $request$idNetworkHorseService $networkHorseService): Response
  31.   {
  32.     $horse Horse::getById($id);
  33.     $auctionHistory $networkHorseService->getAuctionhistory($horse);
  34.     return $this->renderForm('network/horse/sections/horse_section_auction_history.html.twig', [
  35.       'horse' => $horse,
  36.       'history' => $auctionHistory,
  37.     ]);
  38.   }
  39.   #[Route('/{id}/pedigree'name'pedigree')]
  40.   public function pedigree(Request $request$idNetworkHorseService $networkHorseService): Response
  41.   {
  42.     $horse Horse::getById($id);
  43.     return $this->renderForm('network/horse/sections/horse_section_horse_data.html.twig', [
  44.       'horse' => $horse,
  45.     ]);
  46.   }
  47.   #[Route('/{id}/achievements'name'achievements')]
  48.   public function achievements(Request $request$idNetworkHorseService $networkHorseServiceProfileService $profileService): Response
  49.   {
  50.     $horse Horse::getById($id);
  51.     $achievements $networkHorseService->getAchievements($horse);
  52.     $achievementCategories $networkHorseService->getNeededAchievementCategories($achievements);
  53.     return $this->renderForm('network/horse/sections/horse_section_achievements.html.twig', [
  54.       'horse' => $horse,
  55.       'achievements' => $achievements,
  56.       'achievementCategories' => $achievementCategories,
  57.       'profile' => $horse->getOwner(),
  58.     ]);
  59.   }
  60.   #[Route('/{id}/news'name'news')]
  61.   public function news(Request $request$id): Response
  62.   {
  63.     $request->setRequestFormat('text/html');
  64.     return $this->renderForm('network/horse/sections/horse_section_news.html.twig', [
  65.       'horse' => Horse::getById($id),
  66.       // 'horseEvents' => ['auctions' => $horseAuctions, 'racedays' => $horseRacedays],
  67.     ]);
  68.   }
  69.   // horse_section_statistics
  70.   #[Route('/{id}/horse-statistics'name'horse_statistics')]
  71.   public function horseStatistics(Request $request$id): Response
  72.   {
  73.     $request->setRequestFormat('text/html');
  74.     return $this->renderForm('network/horse/sections/horse_section_statistics.html.twig', [
  75.       'horse' => Horse::getById($id),
  76.     ]);
  77.   }
  78. }