Skip to content

Commit eada255

Browse files
committed
fix(form): re-add missing method !
1 parent 538aebd commit eada255

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

inc/form.class.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2582,4 +2582,35 @@ public function showTagsList() {
25822582

25832583
return true;
25842584
}
2585+
2586+
2587+
public function getFromDBByQuestion(PluginFormcreatorQuestion $question) {
2588+
global $DB;
2589+
2590+
if ($question->isNewItem()) {
2591+
return false;
2592+
}
2593+
$questionTable = PluginFormcreatorQuestion::getTable();
2594+
$sectionTable = PluginFormcreatorSection::getTable();
2595+
$iterator = $DB->request([
2596+
'SELECT' => self::getForeignKeyField(),
2597+
'FROM' => PluginFormcreatorSection::getTable(),
2598+
'INNER JOIN' => [
2599+
$questionTable => [
2600+
'FKEY' => [
2601+
$sectionTable => PluginFormcreatorSection::getIndexName(),
2602+
$questionTable => PluginFormcreatorSection::getForeignKeyField()
2603+
]
2604+
]
2605+
],
2606+
'WHERE' => [
2607+
$questionTable . '.' . PluginFormcreatorQuestion::getIndexName() => $question->getID()
2608+
]
2609+
]);
2610+
if ($iterator->count() !== 1) {
2611+
return false;
2612+
}
2613+
return $this->getFromDB($iterator->next()[self::getForeignKeyField()]);
2614+
}
2615+
25852616
}

0 commit comments

Comments
 (0)