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
2dec3c73
Commit
2dec3c73
authored
May 06, 2019
by
Arnaud Bey
Browse files
misc.
parent
c0a34611
Changes
5
Hide whitespace changes
Inline
Side-by-side
INSTALL.md
View file @
2dec3c73
...
...
@@ -19,12 +19,10 @@ git clone https://gricad-gitlab.univ-grenoble-alpes.fr/lzbk/MagicWord.git
cd MagicWord
cp .env.dist .env
vi .env
#vi or any other text editor, this will allow you to set the DB
root
password
#th
is password
will be asked during the install
#vi or any other text editor, this will allow you to set the DB
name &
password
#th
ese informations
will be asked during the install
sudo docker-compose up --build -d
sudo docker-compose exec apache bash
PWD=root
#(optional) this command is to allow you not to enter the db root password (set in .env) for each query that it is supposed to perform
make install
```
...
...
application/src/MagicWordBundle/Command/GenerateGridCommand.php
View file @
2dec3c73
...
...
@@ -35,7 +35,7 @@ class GenerateGridCommand extends ContainerAwareCommand
$grid
=
$gridManager
->
generate
(
$language
);
$timeEnd
=
microtime
(
true
);
$executionTime
=
round
(
$timeEnd
-
$timeStart
,
2
);
$formCount
=
count
(
$grid
->
getFoundableForms
());
$formCount
=
$grid
->
getFoundableForms
()
?
count
(
$grid
->
getFoundableForms
())
:
0
;
if
(
$threshold
&&
$formCount
<
$threshold
)
{
$output
->
writeln
(
'<comment>A grid has been generated but does not contains enough forms ('
.
$formCount
.
'). (generated in '
.
$executionTime
.
' sec.)</comment>'
);
...
...
application/src/MagicWordBundle/Command/GoGridCommand.php
deleted
100644 → 0
View file @
c0a34611
<?php
namespace
MagicWordBundle\Command
;
use
LexiconBundle\Entity\Language
;
use
MagicWordBundle\Manager\GridManager
;
use
Doctrine\ORM\EntityManagerInterface
;
use
Symfony\Component\Console\Command\Command
;
use
Symfony\Component\Console\Input\InputArgument
;
use
Symfony\Component\Console\Input\InputInterface
;
use
Symfony\Component\Console\Input\InputOption
;
use
Symfony\Component\Console\Output\OutputInterface
;
use
Symfony\Component\Console\Style\SymfonyStyle
;
use
Symfony\Component\Stopwatch\Stopwatch
;
class
GoGridCommand
extends
Command
{
protected
static
$defaultName
=
'app:gogrid'
;
public
function
__construct
(
GridManager
$gm
,
EntityManagerInterface
$em
)
{
$this
->
gm
=
$gm
;
$this
->
em
=
$em
;
parent
::
__construct
();
}
protected
function
configure
()
{
$this
->
setDescription
(
'Go Grid ! '
)
->
addArgument
(
'languageid'
,
InputArgument
::
REQUIRED
,
'id of language grid'
)
;
}
protected
function
execute
(
InputInterface
$input
,
OutputInterface
$output
)
{
$io
=
new
SymfonyStyle
(
$input
,
$output
);
$languageId
=
$input
->
getArgument
(
'languageid'
);
$language
=
$this
->
em
->
getRepository
(
Language
::
class
)
->
find
(
$languageId
);
if
(
$language
)
{
$io
->
note
(
sprintf
(
'You passed an argument: %s'
,
$languageId
));
$stopwatch
=
new
Stopwatch
();
$stopwatch
->
start
(
'gen_grid'
);
$grid
=
$this
->
gm
->
generate
(
$language
,
4
);
$foundableForms
=
$grid
->
getFoundableForms
();
foreach
(
$foundableForms
as
$foundableForm
)
{
echo
(
"FF -> "
.
$foundableForm
->
getForm
()
.
"
\n
"
);
}
echo
(
"ID-grid -> "
.
$grid
->
getId
()
.
"
\n
"
);
$stopwatch
->
stop
(
'gen_grid'
);
}
else
{
$io
->
note
(
sprintf
(
'Argument missing'
));
}
}
}
application/src/MagicWordBundle/Entity/Square.php
View file @
2dec3c73
...
...
@@ -26,13 +26,6 @@ class Square
*/
protected
$letter
;
/**
* @var int
*
* @ORM\Column(name="position", type="integer")
*/
private
$position
;
/**
* @ORM\ManyToOne(targetEntity="Grid", inversedBy="squares", cascade={"persist"})
*/
...
...
@@ -48,30 +41,6 @@ class Square
return
$this
->
id
;
}
/**
* Set position.
*
* @param int $position
*
* @return Square
*/
public
function
setPosition
(
$position
)
{
$this
->
position
=
$position
;
return
$this
;
}
/**
* Get position.
*
* @return int
*/
public
function
getPosition
()
{
return
$this
->
position
;
}
/**
* Set grid.
*
...
...
application/src/MagicWordBundle/Manager/SquareManager.php
View file @
2dec3c73
...
...
@@ -27,7 +27,6 @@ class SquareManager
$letter
=
$this
->
em
->
getRepository
(
"LexiconBundle:Letter"
)
->
findOneBy
([
"value"
=>
$letter
,
"language"
=>
$grid
->
getLanguage
()]);
$square
=
new
Square
();
$square
->
setPosition
(
0
);
$square
->
setLetter
(
$letter
);
$square
->
setGrid
(
$grid
);
$this
->
em
->
persist
(
$square
);
...
...
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