Skip to content

Commit 97c84fc

Browse files
authored
Merge pull request #19 from fluffy-factory/archiveData
improve the command to archive
2 parents afb397a + 1b3b745 commit 97c84fc

File tree

5 files changed

+24
-10
lines changed

5 files changed

+24
-10
lines changed

Command/ArchiveUserStatsCommand.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ private function archiveData() :void
7575

7676
$this->output->writeln( "Begin transfert data");
7777
/** @var UserStatsLines $userStatsLinesToArchive */
78-
foreach ($userStatsLinesToArchives as $userStatsLine) {
78+
foreach ($userStatsLinesToArchives as $key => $userStatsLine) {
7979
$progressBar->advance();
8080

8181
$userStatsLinesArchive = new UserStatsLinesArchives();
@@ -90,13 +90,14 @@ private function archiveData() :void
9090

9191
$this->em->persist($userStatsLinesArchive);
9292
$this->em->remove($userStatsLine);
93-
}
94-
$progressBar->finish();
95-
$this->output->writeln( "\nEnd transfert data");
9693

94+
if ($key % 50000 === 0) {
95+
$this->em->flush();
96+
}
97+
}
9798

98-
$this->output->writeln( "Begin flush data");
9999
$this->em->flush();
100-
$this->output->writeln( "End flush data");
100+
$progressBar->finish();
101+
$this->output->writeln( "\nEnd transfert data");
101102
}
102103
}

Resources/translations/UserStatsBundle.en.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ user:
2323
actions:
2424
delete:
2525
stats: Delete user statistics
26+
user:
27+
show: see the user
28+
index_user:
29+
show: See user listing
2630

2731
day:
2832
Monday: Monday
@@ -31,4 +35,4 @@ day:
3135
Thursday: Thursday
3236
Friday: Friday
3337
Saturday: Saturday
34-
Sunday: Sunday
38+
Sunday: Sunday

Resources/translations/UserStatsBundle.fr.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ user:
2323
actions:
2424
delete:
2525
stats: Supprimer les statistiques de l'utilisateur
26+
user:
27+
show: Voir l'utilisateur
28+
index_user:
29+
show: Retourner à la liste des utilisateurs
2630

2731
day:
2832
Monday: Lundi
@@ -31,4 +35,4 @@ day:
3135
Thursday: Jeudi
3236
Friday: Vendredi
3337
Saturday: Samedi
34-
Sunday: Dimanche
38+
Sunday: Dimanche

Resources/translations/UserStatsBundle.nl.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ user:
2323
actions:
2424
delete:
2525
stats: Gebruikers statistieken verwijderen
26+
user:
27+
show: see the user
28+
index_user:
29+
show: See user listing
2630

2731
day:
2832
Monday: Maandag
@@ -31,4 +35,4 @@ day:
3135
Thursday: Donderdag
3236
Friday: Vrijdag
3337
Saturday: Zaterdag
34-
Sunday: Zondag
38+
Sunday: Zondag

Resources/views/user-stats.html.twig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
{% endblock %}
1313

1414
{% block page_actions %}
15-
<a class="btn btn-secondary" href="{{ ea_url().setController('App\\Controller\\SuperAdmin\\UserCrudController').setAction('index') }}">{{ 'action.index'|trans({}, 'EasyAdminBundle') }}</a>
15+
<a class="btn btn-secondary" href="{{ ea_url().setController('App\\Controller\\SuperAdmin\\UserCrudController').setAction('detail').setEntityId(user.id) }}">{{ 'actions.user.show'|trans({}, 'UserStatsBundle') }}</a>
16+
<a class="btn btn-secondary" href="{{ ea_url().setController('App\\Controller\\SuperAdmin\\UserCrudController').setAction('index') }}">{{ 'actions.index_user.show'|trans({}, 'UserStatsBundle') }}</a>
1617
<button type="button" class="btn btn-danger" data-bs-toggle="modal" data-bs-target="#removeUsersStatsModal">{{ 'actions.delete.stats'|trans({}, 'UserStatsBundle') }}</button>
1718
{% endblock %}
1819

0 commit comments

Comments
 (0)