Commit 2dec3c73 authored by Arnaud Bey's avatar Arnaud Bey
Browse files

misc.

parent c0a34611
......@@ -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
#this password will be asked during the install
#vi or any other text editor, this will allow you to set the DB name & password
#these 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
```
......
......@@ -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>');
......
<?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'));
}
}
}
......@@ -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.
*
......
......@@ -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);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment