New proper types

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
John Molakvoæ (skjnldsv) 2020-04-10 15:50:39 +02:00 committed by Jonas Rittershofer
commit 7aa3f7ace0
4 changed files with 31 additions and 10 deletions

View file

@ -39,7 +39,7 @@ use \DateTime;
* Installation class for the forms app.
* Initial db creation
*/
class Version010200Date2020323141300 extends SimpleMigrationStep {
class Version010200Date20200323141300 extends SimpleMigrationStep {
/** @var IDBConnection */
protected $connection;
@ -47,6 +47,15 @@ class Version010200Date2020323141300 extends SimpleMigrationStep {
/** @var IConfig */
protected $config;
/** Map of questionTypes to change */
private $questionTypeMap = [
'radiogroup' => 'multiple_unique',
'checkbox' => 'multiple',
'text' => 'short',
'comment' => 'long',
'dropdown' => 'multiple_unique'
];
/**
* @param IDBConnection $connection
* @param IConfig $config
@ -257,7 +266,7 @@ class Version010200Date2020323141300 extends SimpleMigrationStep {
->values([
'form_id' => $qb_restore->createNamedParameter($id_mapping['events'][$question['form_id']]['newId'], IQueryBuilder::PARAM_INT),
'order' => $qb_restore->createNamedParameter($id_mapping['events'][$question['form_id']]['nextQuestionOrder']++, IQueryBuilder::PARAM_INT),
'type' => $qb_restore->createNamedParameter($question['form_question_type'], IQueryBuilder::PARAM_STR),
'type' => $qb_restore->createNamedParameter($this->questionTypeMap[$question['form_question_type']], IQueryBuilder::PARAM_STR),
'text' => $qb_restore->createNamedParameter($question['form_question_text'], IQueryBuilder::PARAM_STR)
]);
$qb_restore->execute();