PSMList 0.4.0 PSM-040-047
| Ordre affichage : | 45 | Création : | 27/06/2023 14h10 |
| Index BL : | 47 | Modification : | 28/06/2023 00h54 |
| BL : | PSM-040-047 | ||
| Source : | Aucune | Soeurs : | - |
| Fin dev : | D (Done) | Ticket : | - |
| Contrôle dev effectué : | Fiche : | - | |
| C.Qualif. : | #000000 | ||
| Activé : | Icône FA : | Par défaut | |
| Contact : | ARS - Arshellan | Qualification : | Nouveauté |
| Répartition : | - | Module : | Expansion |
| Dev : | ARS - Arshellan | Sous module : | - |
| Provenance : | 0.4.0 New | Constat : | - |
| Début : | S.26 | Charge j. : | - |
| Fin : | S.26 | Délai j. : | - |
| Priorité : | - | Pokercard : | - |
| Estimatif j. : | - | ||
| Description : | A page that updates the counts in expansions, for all expansions. | ||
| Texte Commit : | - | ||
| Description client : | Added a page to update all the cache counters in the expansions. | ||
| Fascicule : | Ne pas communiquer : | ||
| Alerte Mailing : |
| Statut PreP : | OK - Validé | Testeur : | ARS - Arshellan |
php bin/console make:form<br/>ExpansionsItemCountUpdaterType<br/><br/><br/>and inside<br/><br/><br/> $builder<br/> ->add('confirm', CheckboxType::class, [<br/> 'label' => 'I confirm that i want to run this tool :',<br/> 'mapped' => false,<br/> 'required' => false,<br/> ])<br/> ;
AdminController<br/><br/><br/><br/><br/><br/><br/><br/><br/> /**<br/> * @Route("/admin/expansions_item_count_updater", name="expansions_item_count_updater")<br/> */<br/> public function expansions_item_count_updater(GenericServiceTools $gst, EntityManagerInterface $em, Request $request): Response<br/> {<br/> /** @var User $loggedUser **/<br/> $loggedUser = $this->getUser();<br/> if ($loggedUser->getIsadmin() == 0) {<br/> return $this->redirectToRoute('home');<br/> }<br/> <br/> $modifiedOccurrences = 0;<br/><br/> $form = $this->createForm(ExpansionsItemCountUpdaterType::class);<br/> $form->handleRequest($request);<br/><br/> if ($form->isSubmitted() && $form->isValid()) {<br/> if ($form->get('confirm')->getData()) {<br/> $expRepo = $this->doctrine->getRepository(Extension::class);<br/> $expList = $expRepo->findBy(array());<br/><br/> foreach ($expList as $exp) {<br/> $expRepo->updateCountValues($exp);<br/> $modifiedOccurrences++;<br/> }<br/> }<br/> }<br/><br/><br/> return $this->render('admin/expansions_item_count_updater.html.twig', [<br/> 'form' => $form->createView(),<br/> 'modifiedOccurrences' => $modifiedOccurrences,<br/> ]);<br/> }
in the new template file<br/><br/><br/>{% extends 'layout.html.twig' %}<br/><br/>{% block title %}Item Count Updater{% endblock %}<br/><br/>{% block additionnal_meta %}<br/> <meta name="robots" content="noindex" /><br/> <meta name="googlebot" content="noindex" /><br/>{% endblock %}<br/><br/>{% block additionnal_style %}<br/> <link rel="stylesheet" type="text/css" href="{{ asset('css/form.css') }}"><br/>{% endblock %}<br/><br/>{% block content_container %}<br/> <section class="flexRow"><br/> <div class="whitebox"><br/> <h2>Item Count Updater</h2><br/> <p>This tool updates all the cached counts for ships/crew/treasures in all expansions.</p><br/> <div class="form_container form_generated"><br/> {{ form_start(form) }}<br/> {{ form_widget(form) }}<br/> <a href="{{ path('admin_portal') }}" class="button-grey">Back</a><br/> <input type="submit" class="button" value="Run the tool"><br/> {{ form_end(form) }}<br/> </div><br/> <br><br/> <p>{{ modifiedOccurrences }} expansions have been modified.</p><br/> </div><br/> </section><br/>{% endblock %}