Commit 1e5f39ff authored by Marc Egger's avatar Marc Egger
Browse files

Refs #10120 Teste form zu json

parent df2f71d6
Pipeline #3518 failed with stages
in 2 minutes and 38 seconds
<?php
namespace IMATHUZH\Qfq\Core\Form;
use IMATHUZH\Qfq\Core\Database\Database;
class FormAsFile
{
public function databaseToJson(string $formName, Database $database) {
$constant = F_NAME; // can't use constants in strings directly (below)
$form = $database->sql("SELECT * FROM `Form` AS f WHERE `f`.`$constant` LIKE ? AND `f`.`deleted`='no'", ROW_EXPECT_1,
[$formName], 'Form "' . $formName . '" not found or multiple forms with the same name.');
throw new \UserFormException(json_encode([
ERROR_MESSAGE_TO_USER => 'Marc debug error',
ERROR_MESSAGE_TO_DEVELOPER => json_encode($form, JSON_PRETTY_PRINT)
]));
}
}
\ No newline at end of file
...@@ -15,6 +15,7 @@ use IMATHUZH\Qfq\Core\Database\DatabaseUpdate; ...@@ -15,6 +15,7 @@ use IMATHUZH\Qfq\Core\Database\DatabaseUpdate;
use IMATHUZH\Qfq\Core\Form\Dirty; use IMATHUZH\Qfq\Core\Form\Dirty;
use IMATHUZH\Qfq\Core\Form\DragAndDrop; use IMATHUZH\Qfq\Core\Form\DragAndDrop;
use IMATHUZH\Qfq\Core\Form\FormAction; use IMATHUZH\Qfq\Core\Form\FormAction;
use IMATHUZH\Qfq\Core\Form\FormAsFile;
use IMATHUZH\Qfq\Core\Helper\HelperFile; use IMATHUZH\Qfq\Core\Helper\HelperFile;
use IMATHUZH\Qfq\Core\Helper\HelperFormElement; use IMATHUZH\Qfq\Core\Helper\HelperFormElement;
use IMATHUZH\Qfq\Core\Helper\KeyValueStringParser; use IMATHUZH\Qfq\Core\Helper\KeyValueStringParser;
...@@ -997,6 +998,11 @@ class QuickFormQuery { ...@@ -997,6 +998,11 @@ class QuickFormQuery {
$this->store->setVar(CLIENT_RECORD_ID, $rTmp, STORE_TYPO3); $this->store->setVar(CLIENT_RECORD_ID, $rTmp, STORE_TYPO3);
} }
///////////////// JUST A TEST, DELETE ME! //////////////
$formASFile = new FormAsFile();
$formASFile->databaseToJson('person', $this->dbArray[$this->dbIndexQfq]);
///////////////// TEST FINISHED ////////////////////////
// Load form // Load form
$constant = F_NAME; // PhpStorm complains if the constant is directly defined in the string below $constant = F_NAME; // PhpStorm complains if the constant is directly defined in the string below
$form = $this->dbArray[$this->dbIndexQfq]->sql("SELECT * FROM `Form` AS f WHERE `f`.`$constant` LIKE ? AND `f`.`deleted`='no'", ROW_EXPECT_1, $form = $this->dbArray[$this->dbIndexQfq]->sql("SELECT * FROM `Form` AS f WHERE `f`.`$constant` LIKE ? AND `f`.`deleted`='no'", ROW_EXPECT_1,
......
Supports Markdown
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