Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Commit 567aced1 authored by Arnaud Bey's avatar Arnaud Bey
Browse files

features not flushed everytime

parent 00e88172
......@@ -24,19 +24,21 @@ class FeatureManager
$this->em = $em;
}
public function findOrCreate(Language $language, $label, $value)
public function findOrCreate(Language $language, $label, $value, &$features)
{
$feature = $this->em->getRepository(Feature::class)->findOneBy(['value' => $value, 'label' => $label, 'language' => $language]);
if (!$feature) {
$feature = new Feature();
$feature->setLanguage($language);
$feature->setValue($value);
$feature->setLabel($label);
$this->em->persist($feature);
$this->em->flush();
if (!isset($features[$label][$value])) {
if (!$feature = $this->em->getRepository(Feature::class)->findOneBy(['value' => $value, 'label' => $label, 'language' => $language])) {
$feature = new Feature();
$feature->setLanguage($language);
$feature->setValue($value);
$feature->setLabel($label);
$this->em->persist($feature);
$features[$label][$value] = $feature;
}
}
return $feature;
return $features[$label][$value];
}
}
......@@ -136,6 +136,7 @@ class ImportManager
$lengths = $specs["lengths"];
$pathLexiconDir = $specs["directory"];
$roots = [];
$features = [];
$letters = [];
$wordStarts = [];
$flushCpt = 0;
......@@ -205,6 +206,8 @@ class ImportManager
$flushCpt = 1;
$roots = null;
$roots = [];
$features = null;
$features = [];
$languageId = $specs["language_id"];
$language = $this->em->getRepository(Language::class)->find($languageId);
$percent = round($cpt / $total * 100, 2);
......
Markdown is supported
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