Commit f3ebe6f6 authored by Arnaud Bey's avatar Arnaud Bey
Browse files

fix import/export

parent 82f12d05
......@@ -63,9 +63,13 @@ class Constraint extends Objective
$jsonArray = array(
'type' => $this->discr,
'numberToFind' => $this->numberToFind,
'features' => $this->feature ? $this->feature->getId() : null,
'features' => []
);
foreach ($this->features as $feature) {
$jsonArray["features"][] = $feature->getId();
}
return $jsonArray;
}
/**
......
......@@ -108,29 +108,12 @@ class ImportManager
$properties = [];
$properties['numberToFind'] = $objectiveJSON['numberToFind'];
$properties['category'] = ($objectiveJSON['category'])
? $this->em->getRepository('LexiconBundle:Category')->findOneById($objectiveJSON['category'])
: null;
$properties['gender'] = ($objectiveJSON['gender'])
? $this->em->getRepository('LexiconBundle:Gender')->findOneById($objectiveJSON['gender'])
: null;
$properties['tense'] = ($objectiveJSON['tense'])
? $this->em->getRepository('LexiconBundle:Tense')->findOneById($objectiveJSON['tense'])
: null;
$properties['person'] = ($objectiveJSON['person'])
? $this->em->getRepository('LexiconBundle:Person')->findOneById($objectiveJSON['person'])
: null;
$properties['mood'] = ($objectiveJSON['mood'])
? $this->em->getRepository('LexiconBundle:Mood')->findOneById($objectiveJSON['mood'])
: null;
$properties['number'] = ($objectiveJSON['number'])
? $this->em->getRepository('LexiconBundle:Number')->findOneById($objectiveJSON['number'])
: null;
$properties['features'] = [];
foreach ($objectiveJSON['features'] as $f) {
if ($feature = $this->em->getRepository('LexiconBundle:Feature')->findOneById($f)) {
$properties['features'][] = $feature;
}
}
$this->objectiveManager->generateConstraint($round, $properties);
......
......@@ -173,13 +173,10 @@ class ObjectiveManager
{
$constraint = new Constraint();
foreach ($properties["features"] as $feature) {
$constraint->addFeature($feature);
}
$constraint->setNumberToFind($properties['numberToFind']);
$constraint->setCategory($properties['category']);
$constraint->setGender($properties['gender']);
$constraint->setTense($properties['tense']);
$constraint->setPerson($properties['person']);
$constraint->setMood($properties['mood']);
$constraint->setNumber($properties['number']);
$constraint->setConquer($conquer);
$this->em->persist($constraint);
......
......@@ -31,9 +31,6 @@
{{ form_label(findWord.lemmaEnough) }}
{{ form_widget(findWord.lemmaEnough) }}
<span class="float-right">
<span class="btn btn-sm btn-outline-secondary disabled">
<i class="fa fa-wikipedia-w" aria-hidden="true"></i>
</span>
<span onclick="objectives.remove(this);" class="btn btn-sm btn-danger">
<i class="fa fa-times" aria-hidden="true"></i>
</span>
......
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