Era brevis ratione est
Diatrias tolerare tanquam noster caesium. Ut suscipit posuere justo at vulputate. Sunt accentores vitare salvus flavum parses. Ubi est audax amicitia. Morbi tempus commodo mattis. Abnobas sunt hilotaes de placidus vita.
Choose your language
2023(e)ko azaroakren 16(a) 09:34:15 Tom Doe
Diatrias tolerare tanquam noster caesium. Ut suscipit posuere justo at vulputate. Sunt accentores vitare salvus flavum parses. Ubi est audax amicitia. Morbi tempus commodo mattis. Abnobas sunt hilotaes de placidus vita.
Demo aplikazio hau Symfony frameworkarekin programatu da Symfony aplikazioak programatzeko modu gomendatua erakusteko.
Informazio gehiago nahi izanez gero, Symfonyren dokumentazioa kontsultatu.
Sakatu botoi hau kontrolatzailearen eta txantiloiaren iturburu-kodea ikusteko.
src/Presentation/Controller/Blog/Visitor/Post/GetLatestPostsController.php at line 55
/**
* NOTE: For standard formats, Symfony will also automatically choose the best
* Content-Type header for the response.
*
* See https://symfony.com/doc/current/routing.html#special-parameters
*
* @param Request $request
* @param int $page
* @param string $_format
* @return Response
*/
#[Route('/', name: 'blog_index', defaults: ['page' => '1', '_format' => 'html'], methods: ['GET'])]
#[Route('/rss.xml', name: 'blog_rss', defaults: ['page' => '1', '_format' => 'xml'], methods: ['GET'])]
#[Route(
'/page/{page<[1-9]\d{0,8}>}',
name: 'blog_index_paginated',
defaults: ['_format' => 'html'],
methods: ['GET']
)]
#[Cache(smaxage: 10)]
public function index(Request $request, int $page, string $_format): Response
{
// Here we call usecase to retrieve latest posts
$this
->getLatestPostsUsecase
->setRequest($this->getLatestPostsRequest::from([
'tag' => $request->query->get('tag'),
'page' => $page,
]))
->setPresenter($this->getLatestPostsPresenter)
->execute();
// Every template name also has two extensions that specify the format and
// engine for that template.
// See https://symfony.com/doc/current/templates.html#template-naming
return $this->render('blog/index.' . $_format . '.twig', $this->getLatestPostsPresenter->getResponseData());
}