Skip to content
GitLab
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
f3ebe6f6
Commit
f3ebe6f6
authored
Jun 19, 2019
by
Arnaud Bey
Browse files
fix import/export
parent
82f12d05
Changes
4
Hide whitespace changes
Inline
Side-by-side
application/src/MagicWordBundle/Entity/ObjectiveType/Constraint.php
View file @
f3ebe6f6
...
...
@@ -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
;
}
/**
...
...
application/src/MagicWordBundle/Manager/ImportManager.php
View file @
f3ebe6f6
...
...
@@ -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
);
...
...
application/src/MagicWordBundle/Manager/ObjectiveManager.php
View file @
f3ebe6f6
...
...
@@ -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
);
...
...
application/src/MagicWordBundle/Resources/views/Round/Conquer/Objective/findword.html.twig
View file @
f3ebe6f6
...
...
@@ -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>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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