Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Mathieu Loiseau
MagicWord
Commits
a3636a2a
Commit
a3636a2a
authored
Jun 12, 2019
by
Arnaud Bey
Browse files
add index && fix delete grid cmd
parent
ca6c2731
Changes
2
Hide whitespace changes
Inline
Side-by-side
application/src/MagicWordBundle/Command/DeleteGridCommand.php
View file @
a3636a2a
...
...
@@ -13,11 +13,13 @@ use MagicWordBundle\Entity\Grid;
use
MagicWordBundle\Entity\Objective
;
use
MagicWordBundle\Entity\Round
;
use
MagicWordBundle\Entity\Score
;
use
MagicWordBundle\Entity\Wordbox\Acquisition
;
use
MagicWordBundle\Entity\WrongForm
;
use
Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand
;
use
Symfony\Component\Console\Input\InputArgument
;
use
Symfony\Component\Console\Input\InputInterface
;
use
Symfony\Component\Console\Output\OutputInterface
;
use
Symfony\Component\Console\Question\Question
;
use
Symfony\Component\Filesystem\Filesystem
;
class
DeleteGridCommand
extends
ContainerAwareCommand
...
...
@@ -41,6 +43,9 @@ class DeleteGridCommand extends ContainerAwareCommand
$language
=
$em
->
getRepository
(
Language
::
class
)
->
find
(
$idLexicon
);
echo
'You passed an argument: '
.
$idLexicon
.
"
\n\n
"
;
$em
->
getRepository
(
Acquisition
::
class
)
->
deleteByLanguage
(
$language
);
$output
->
writeln
(
'<comment>Suppression acquisitions</comment>'
);
$games
=
$em
->
getRepository
(
Game
::
class
)
->
findByLanguage
(
$language
);
foreach
(
$games
as
$game
)
{
$scores
=
$em
->
getRepository
(
Score
::
class
)
->
findByGame
(
$game
);
...
...
@@ -60,9 +65,27 @@ class DeleteGridCommand extends ContainerAwareCommand
$output
->
writeln
(
'<comment>Suppression game ok</comment>'
);
// delete grid
$rounds
=
$em
->
getRepository
(
Round
::
class
)
->
findByLanguage
(
$language
);
foreach
(
$rounds
as
$round
)
{
$em
->
remove
(
$round
);
}
$em
->
flush
();
$output
->
writeln
(
'<comment>Suppression Round ok</comment>'
);
// delete grid
$i
=
0
;
$grids
=
$em
->
getRepository
(
Grid
::
class
)
->
findByLanguage
(
$language
);
foreach
(
$grids
as
$grid
)
{
$em
->
remove
(
$grid
);
$i
++
;
if
(
$i
>
500
)
{
$em
->
flush
();
$i
=
0
;
$output
->
writeln
(
'<comment>Suppression grilles...</comment>'
);
}
}
$em
->
flush
();
$output
->
writeln
(
'<info>############ SUPPRESSION GRIDS OK #############</info>'
);
...
...
application/src/MagicWordBundle/Entity/FoundableForm.php
View file @
a3636a2a
...
...
@@ -3,9 +3,12 @@
namespace
MagicWordBundle\Entity
;
use
Doctrine\ORM\Mapping
as
ORM
;
use
Doctrine\ORM\Mapping\Index
;
/**
* @ORM\Table(name="foundable_form")
* @ORM\Table(name="foundable_form", indexes={
* @Index(columns={"form"}, name="form"),
* }))
* @ORM\Entity(repositoryClass="MagicWordBundle\Repository\FoundableRepository")
*/
class
FoundableForm
implements
\
JsonSerializable
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment