94 search results

…reply. Its worked for me very well! I have another question. Is it possible to omit **prev** and **next** links while rendering pagerfanta? I need only the page numbers... I am searching in the documentation and I was try to inspect source code too, but…
skocdopolet
skocdopolet
Read Full Comment
… That's an excellent question! Here's how to do this, on your template: ``` {{ pagerfanta(pager, 'default', {'pageParameter': '[activePage]'}) }} ``` Ref: bottom of https://www.babdev.com/open-source/packages/pagerfantabundle/docs/3.x/rendering-pagerfantas Then, of course, you'll read `$request->query->get('activePage…
weaverryan
weaverryan
Read Full Comment
…pagination for both of lists. But the parameter page is in collision with each other. How I can specify for each pagerfanta name of parameter for pagination? For example to have activePage parameter for active messages parameter and archivePage for archived messages? So URL should…
skocdopolet
skocdopolet
Read Full Comment
36 lines | src/Controller/RecipeController.php
// ... lines 1 - 12
class RecipeController extends AbstractController
{
#[Route('/recipes/{page<\d+>}', name: 'app_recipes')]
public function recipes(RecipeRepository $recipeRepository, int $page = 1): Response
{
$queryBuilder = $recipeRepository->createQueryBuilderOrderedByNewest();
$adapter = new QueryAdapter($queryBuilder);
/** @var Recipe[]|Pagerfanta $pagerfanta */
$pagerfanta = Pagerfanta::createForCurrentPageWithMaxPerPage($adapter, $page, 4);
return $this->render('recipes/list.html.twig', [
'pager' => $pagerfanta,
]);
}
// ... lines 27 - 34
}
See Code Block in Script
56 lines | templates/vinyl/browse.html.twig
// ... lines 1 - 27
<turbo-frame id="mix-browse-list-{{ pager.currentPage }}">
<div class="row">
// ... lines 30 - 47
{% if pager.hasNextPage %}
<turbo-frame id="mix-browse-list-{{ pager.nextPage }}" src="{{ pagerfanta_page_url(pager, pager.nextPage) }}" loading="lazy"></turbo-frame>
{% endif %}
</div>
</turbo-frame>
// ... lines 53 - 56
See Code Block in Script
58 lines | src/Controller/VinylController.php
// ... lines 1 - 8
use Symfony\Component\HttpFoundation\Request;
// ... lines 10 - 13
class VinylController extends AbstractController
{
// ... lines 16 - 39
public function browse(VinylMixRepository $mixRepository, Request $request, string $slug = null): Response
{
// ... lines 42 - 45
$pagerfanta = Pagerfanta::createForCurrentPageWithMaxPerPage(
// ... line 47
$request->query->get('page', 1),
// ... line 49
);
// ... lines 51 - 55
}
}
See Code Block in Script
…Please run composer update. Problem 1 - babdev/pagerfanta-bundle is locked to version v2.5.2 and an update of this package was not requested. - babdev/pagerfanta-bundle v2.5.2 requires php ^7.2 -> your php version (8.1.2) does not satisfy…
…with the final pagination translation. I want to translate the Previous and Next to czech, but making pagerfanta.cs.yaml didn't work, I've also found the translations included with pagerfanta so it should translate by itself, but it's not. My services.yaml…
Matěj V.
Matěj V.
Read Full Comment
…it! Hm, was it successfully installed? No errors? Could you try to install those 3 packages again with: $ composer require babdev/pagerfanta-bundle pagerfanta/doctrine-orm-adapter pagerfanta/twig What Composer output do you have? No errors? Nothing to install or update? Also, could…
Hey Ccc123! Hm, what did you do? Are you trying to call pagerfanta() Twig function in your template? If so, it looks like the bundle isn't installed/enabled in your project. Make sure you installed it via Composer, Symony Flex should enable it for…
…0", "sensio/framework-extra-bundle": "^3.0.2", "incenteev/composer-parameter-handler": "~2.0", "jms/serializer-bundle": "^1.1.0", "white-october/pagerfanta-bundle": "^1.0", "lexik/jwt-authentication-bundle": "^1.4", "willdurand/hateoas": "^2.11" }, In AppKernel.php: $bundles = array( new Bazinga\Bundle…
Diaconescu
Diaconescu
Read Full Comment
57 lines | src/Controller/VinylController.php
// ... lines 1 - 38
public function browse(VinylMixRepository $mixRepository, string $slug = null): Response
{
// ... lines 41 - 50
return $this->render('vinyl/browse.html.twig', [
// ... line 52
'pager' => $pagerfanta,
]);
}
// ... lines 56 - 57
See Code Block in Script
88 lines | src/Controller/QuestionController.php
// ... lines 1 - 17
class QuestionController extends AbstractController
{
// ... lines 20 - 29
/**
* @Route("/{page<\d+>}", name="app_homepage")
*/
public function homepage(QuestionRepository $repository, int $page = 1)
{
// ... lines 35 - 38
$pagerfanta->setCurrentPage($page);
// ... lines 40 - 43
}
// ... lines 45 - 86
}
See Code Block in Script
Hey Dirk Actually no, `count($programmers)` it's the count of results shown in the page, and `$pagerfanta->getNbResults()` is the total number of results found in the database. Cheers!
MolloKhan
MolloKhan
Read Full Comment
// ... lines 1 - 10
use AppBundle\Pagination\PaginatedCollection;
// ... lines 12 - 21
class ProgrammerController extends BaseController
{
// ... lines 24 - 79
public function listAction(Request $request)
{
// ... lines 82 - 96
$paginatedCollection = new PaginatedCollection($programmers, $pagerfanta->getNbResults());
// ... lines 98 - 117
$response = $this->createApiResponse($paginatedCollection, 200);
return $response;
}
// ... lines 122 - 220
}
See Code Block in Script
// ... lines 1 - 108
$paginatedCollection->addLink('first', $createLinkUrl(1));
$paginatedCollection->addLink('last', $createLinkUrl($pagerfanta->getNbPages()));
// ... lines 111 - 222
See Code Block in Script
// ... lines 1 - 10
class PaginationFactory
{
// ... lines 13 - 19
public function createCollection(QueryBuilder $qb, Request $request, $route, array $routeParams = array())
{
// ... lines 22 - 33
$paginatedCollection = new PaginatedCollection($programmers, $pagerfanta->getNbResults());
// make sure query parameters are included in pagination links
$routeParams = array_merge($routeParams, $request->query->all());
// ... lines 38 - 56
}
}
See Code Block in Script
// ... lines 1 - 10
class PaginationFactory
{
// ... lines 13 - 19
public function createCollection(QueryBuilder $qb, Request $request, $route, array $routeParams = array())
{
// ... lines 22 - 33
$paginatedCollection = new PaginatedCollection($programmers, $pagerfanta->getNbResults());
// ... lines 35 - 55
return $paginatedCollection;
}
}
See Code Block in Script
…the change to take effect. 2. Rewrite the query. I think the easiest would be to replace `StarshipRepository::findIncompleteOrderedByDroidCount()` method with: ``` public function findIncompleteOrderedByDroidCount(): Pagerfanta { $subQuery = $this->getEntityManager() ->createQueryBuilder() ->select('COUNT(sd.id)') ->from(StarshipDroid::class, 'sd') ->where('sd.starship = s.id') ->getDQL() ; …
…2 entity tables side by side (or in 2 tabs) with a modal form for **add** and **edit** as well as independent sorting and pagination (pagerfanta) is it better to use a LiveComponent (for each entity list) structure or rather turbo streams/ frames for each…
michitheonlyone
michitheonlyone
Read Full Comment