Commit b679902c authored by Carsten  Rose's avatar Carsten Rose
Browse files

Store classes moved to subdirectory qfq/store

parent 564a5e60
......@@ -19,17 +19,19 @@ const ERROR_UNKNOWN_STORE = 1003;
const ERROR_VALUES_ALREADY_CODPIED = 1004;
const ERROR_SETVARARRAY_NOT_IMPLEMENTED = 1005;
const ERROR_MISSING_FORM_NAME = 1006;
const ERROR_IN_SQL_STATEMENT = 1007;
// Store Identifier
// store Identifier
const STORE_FORM = "F"; // form, still not saved in database
const STORE_SIP = "S"; // SIP
const STORE_RECORD = "R"; // selected record from primary table.
const STORE_DATABASE_DEFINITION = "D"; // Default definition in database
const STORE_TABLE_DEFINITION = "T"; // table definition in database of primary table
const STORE_CLIENT = "C"; // Client: POST variable, if not found: GET variable
const STORE_T3_BODYTEXT = "B"; // Typo3 > Page content record > bodytext
const STORE_ZERO = "0"; // value: 0, might helpfull if variable is empty but used in an SQL statement, which might produce a SQL error otherwise if substituted with an empty string
const STORE_SETUP = "P"; // various setup values like db connection credentials
const USE_STORE_DEFAULT = "FSRD";
const USE_STORE_DEFAULT = "FSRT";
// URL variables
......
......@@ -11,8 +11,9 @@ namespace qfq;
use qfq;
use qfq\exceptions\UserException;
use qfq\store;
require_once(__DIR__ . '/../qfq/Store.php');
require_once(__DIR__ . '/../qfq/store/Store.php');
require_once(__DIR__ . '/../qfq/Constants.php');
require_once(__DIR__ . '/../qfq/helper/KeyValueStringParser.php');
require_once(__DIR__ . '/../qfq/exceptions/UserException.php');
......@@ -41,9 +42,7 @@ class Form {
* doActions 'After'
*/
$this->store = Store::getInstance();
$this->store = \qfq\store\Store::getInstance();
}
......@@ -83,17 +82,17 @@ class Form {
private function getFormName() {
// Store: T3 Bodytext
// store: T3 Bodytext
$formName = $this->store->getVar(T3_BODYTEXT_FORM, STORE_T3_BODYTEXT);
if ($formName !== false)
return $formName;
// Store: SIP
// store: SIP
// $fomName = $this->store->getVar(????_FORM, STORE_SIP);
// if($formName !== false)
// return $formName;
// Store: CLIENT
// store: CLIENT
$formName = $this->store->getVar(CLIENT_FORM, STORE_CLIENT);
if ($formName !== false)
return $formName;
......
......@@ -6,13 +6,16 @@
* Time: 6:51 PM
*/
namespace qfq;
namespace qfq\store;
use qfq\exceptions\CodeException;
use qfq;
require_once(__DIR__ . '/../qfq/StoreWebVar.php');
require_once(__DIR__ . '/../qfq/StoreT3Bodytext.php');
require_once(__DIR__ . '/../qfq/Constants.php');
//use qfq\store\StoreT3Bodytext;
require_once(__DIR__ . '/../../qfq/store/StoreWebVar.php');
require_once(__DIR__ . '/../../qfq/store/StoreT3Bodytext.php');
require_once(__DIR__ . '/../../qfq/Constants.php');
/*
......@@ -28,16 +31,18 @@ class Store {
private static $instance = null;
// Store Classes
// store Classes
public $StoreWebVar = null;
public $StoreT3Bodytext = null;
public $StoreSetup = null;
/**
* Design Pattern: Singleton - class 'Store' should only be instanced once.
* Design Pattern: Singleton - class 'store' should only be instanced once.
*/
private function __construct() {
$this->StoreWebVar = StoreWebVar::getInstance();
$this->StoreT3Bodytext = StoreT3Bodytext::getInstance();
// $this->StoreSetup = StoreSetup::getInstance();
}
/**
......@@ -78,13 +83,13 @@ class Store {
case STORE_FORM:
case STORE_SIP:
case STORE_RECORD:
case STORE_DATABASE_DEFINITION:
case STORE_TABLE_DEFINITION:
case STORE_ZERO:
throw new CodeException("Store not implemented: $store", ERROR_STORE_NOT_IMPLEMENTED);
throw new CodeException("store not implemented: $store", ERROR_STORE_NOT_IMPLEMENTED);
break;
default:
throw new CodeException("Unknown Store: $store", ERROR_UNKNOWN_STORE);
throw new CodeException("Unknown store: $store", ERROR_UNKNOWN_STORE);
break;
}
......@@ -112,17 +117,15 @@ class Store {
case STORE_FORM:
case STORE_SIP:
case STORE_RECORD:
case STORE_DATABASE_DEFINITION:
case STORE_TABLE_DEFINITION:
case STORE_ZERO:
throw new CodeException("Store not implemented: $store", ERROR_STORE_NOT_IMPLEMENTED);
throw new CodeException("store not implemented: $store", ERROR_STORE_NOT_IMPLEMENTED);
break;
default:
throw new CodeException("Unknown Store: $store", ERROR_UNKNOWN_STORE);
throw new CodeException("Unknown store: $store", ERROR_UNKNOWN_STORE);
break;
}
}
}
......
......@@ -6,12 +6,14 @@
* Time: 12:52 PM
*/
namespace qfq;
namespace qfq\store;
use qfq\Sanatize;
use qfq\exceptions;
use qfq\exceptions\CodeException;
require_once(__DIR__ . '/../qfq/Constants.php');
require_once(__DIR__ . '/../qfq/Sanatize.php');
require_once(__DIR__ . '/../../qfq/Constants.php');
require_once(__DIR__ . '/../../qfq/Sanatize.php');
class StoreT3Bodytext {
......@@ -37,7 +39,7 @@ class StoreT3Bodytext {
/**
* Design Pattern: Singleton - class should only be instanced once.
*
* @return Store
* @return StoreT3Bodytext
*/
public static function getInstance() {
// Design Pattern: Singleton
......
......@@ -6,10 +6,14 @@
* Time: 6:51 PM
*/
namespace qfq;
namespace qfq\store;
require_once(__DIR__ . '/../qfq/Constants.php');
require_once(__DIR__ . '/../qfq/Sanatize.php');
use qfq\Sanatize;
use qfq\exceptions;
use qfq\exceptions\CodeException;
require_once(__DIR__ . '/../../qfq/Constants.php');
require_once(__DIR__ . '/../../qfq/Sanatize.php');
class StoreWebVar {
......
......@@ -6,11 +6,13 @@
* Time: 9:16 PM
*/
namespace qfq;
namespace qfq\store;
use qfq;
//use qfq\exceptions\CodeException;
require_once(__DIR__ . '/../../qfq/Store.php');
require_once(__DIR__ . '/../../qfq/store/Store.php');
require_once(__DIR__ . '/../../qfq/Constants.php');
require_once(__DIR__ . '/../../qfq/exceptions/CodeException.php');
......
......@@ -6,10 +6,10 @@
* Time: 10:53 PM
*/
namespace qfq;
namespace qfq\store;
require_once(__DIR__ . '/../../qfq/Constants.php');
require_once(__DIR__ . '/../../qfq/StoreWebVar.php');
require_once(__DIR__ . '/../../qfq/store/StoreWebVar.php');
class StoreWebVarTest extends \PHPUnit_Framework_TestCase {
......
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