You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When my application is in Dev mode, I have no problem however when I switch it to prod mode, it asks me to initialize the InterfacePaginator. I use symfony 4.4.
Controller Code :
public function fichesSorties(PaginatorInterface $paginator, Request $request){
// On appelle ici la liste des fiches agents
$recherche = new Recherche();
$formRecherche = $this->createForm(RechercheType::class, $recherche);
$formRecherche->handleRequest($request);
$data = $this->RechercheResultRepository($formRecherche);
if ($data != []){
$essais = $this->getDoctrine()->getRepository(Fiche::class)->findByLike($data);
}else{
$essais = $this->getDoctrine()->getRepository(Fiche::class)->findAll();
}
$dateJour = date('Y-m-d');
$fiches = $this->Pagination($paginator, $request, false, 6, $essais);
return $this->render('/Twig/FichesSorties/FichesSorties.html.twig', [
'fiches' => $fiches,
'dateJour' => $dateJour,
'formRecherche' => $formRecherche->createView(),
]);
}
public function Pagination (PaginatorInterface $paginator, Request $request, ?bool $condition, int $limitePage, array $resultRepository){
$stack = array();
// Numéro de la page en cours, passé dans l'URL, 1 si aucune page
$page = $request->query->getInt('page', 1);
/*On récupère les données de la base */
$requete = $resultRepository;
if ($condition === true) {
foreach ($requete as $ficheValue) {
if ($ficheValue->getSortie() != true){
array_push($stack, $ficheValue);
}
}
} else if ($condition === false) {
foreach ($requete as $ficheValue) {
if ($ficheValue->getSortie() == true){
array_push($stack, $ficheValue);
}
}
}
else {
$stack = $requete;
}
// la pagination
$lesDonnees = $paginator->paginate(
$stack,
$page,
$limitePage
);
return $lesDonnees;
}
knp_paginator.yaml :
knp_paginator:
page_range: 3 # number of links shown in the pagination menu
default_options:
page_name: page # page query parameter name
sort_field_name: sort # sort field query parameter name
sort_direction_name: direction # sort direction query parameter name
distinct: true # ensure distinct results, useful when ORM queries are using GROUP BY statements
#filter_field_name: filterField # filter field query parameter name
#filter_value_name: filterValue # filter value query parameter name
template:
pagination: '@KnpPaginator/Pagination/twitter_bootstrap_v4_pagination.html.twig' # sliding pagination controls template
sortable: '@KnpPaginator/Pagination/sortable_link.html.twig' # sort link template
filtration: '@KnpPaginator/Pagination/filtration.html.twig' # filters template
I don’t know where the mistake comes from can you help me
The text was updated successfully, but these errors were encountered:
I have this error : Uncaught PHP Exception RuntimeException: "Controller "App\Controller\ControlleurVue::ListeDemande()" requires that you provide a value for the "$paginator" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one." at .../symfony/http-kernel/Controller/ArgumentResolver.php line 80
The error you're reporting is inconsistent with the code you provided above.
Moreover, the code you provided above is incomplete (it misses namespace declarations)
Good morning,
When my application is in Dev mode, I have no problem however when I switch it to prod mode, it asks me to initialize the InterfacePaginator. I use symfony 4.4.
Controller Code :
knp_paginator.yaml :
I don’t know where the mistake comes from can you help me
The text was updated successfully, but these errors were encountered: