File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments