|
@@ -968,10 +968,11 @@ class TableAcl extends Core_AclBase {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public function loadSchema() {
|
|
public function loadSchema() {
|
|
|
- if ($this->_schemaLoaded) return;
|
|
|
|
|
|
|
+ if ($this->_schemaLoaded) return (bool)$this->_schemaClass;
|
|
|
$srvName = $_SERVER['SERVER_NAME'];
|
|
$srvName = $_SERVER['SERVER_NAME'];
|
|
|
$this->_schemaClass = Schema_TableFactory::build($this->_name, $this->_db, $srvName);
|
|
$this->_schemaClass = Schema_TableFactory::build($this->_name, $this->_db, $srvName);
|
|
|
$this->_schemaLoaded = true;
|
|
$this->_schemaLoaded = true;
|
|
|
|
|
+ return (bool)$this->_schemaClass;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public function init($force = false) {
|
|
public function init($force = false) {
|
|
@@ -979,11 +980,11 @@ class TableAcl extends Core_AclBase {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public function fieldsInit($force = false) {
|
|
public function fieldsInit($force = false) {
|
|
|
|
|
+ $this->loadSchema();
|
|
|
if (null !== $this->_executed_fieldsInit) return;
|
|
if (null !== $this->_executed_fieldsInit) return;
|
|
|
$this->_executed_fieldsInit = true;
|
|
$this->_executed_fieldsInit = true;
|
|
|
|
|
|
|
|
DBG::log("DBG INIT - fieldsInit ({$this->_zasobID}, {$this->_rootTableName})");
|
|
DBG::log("DBG INIT - fieldsInit ({$this->_zasobID}, {$this->_rootTableName})");
|
|
|
- $this->loadSchema();
|
|
|
|
|
if (empty($this->_fields)) {
|
|
if (empty($this->_fields)) {
|
|
|
$this->_types = array();// clear _types @see $this->isInitialized
|
|
$this->_types = array();// clear _types @see $this->isInitialized
|
|
|
$userAcl = User::getAcl();
|
|
$userAcl = User::getAcl();
|
|
@@ -1017,7 +1018,7 @@ class TableAcl extends Core_AclBase {
|
|
|
$this->_sortEnumFields();
|
|
$this->_sortEnumFields();
|
|
|
$this->_fixProjectType();
|
|
$this->_fixProjectType();
|
|
|
|
|
|
|
|
- if ($this->_schemaClass) $this->_types = $this->_schemaClass->fixTypes($this->_types);
|
|
|
|
|
|
|
+ if ($this->loadSchema()) $this->_types = $this->_schemaClass->fixTypes($this->_types);
|
|
|
//DBG::_(true, true, "this->_types", $this->_types, __CLASS__, __FUNCTION__, __LINE__);
|
|
//DBG::_(true, true, "this->_types", $this->_types, __CLASS__, __FUNCTION__, __LINE__);
|
|
|
|
|
|
|
|
// fixGeomTypesFromSimpleType
|
|
// fixGeomTypesFromSimpleType
|
|
@@ -1547,7 +1548,7 @@ class TableAcl extends Core_AclBase {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public function getHistItems($primaryKey) {
|
|
public function getHistItems($primaryKey) {
|
|
|
- if ($this->_schemaClass && method_exists($this->_schemaClass, 'hasGetHistItems') && $this->_schemaClass->hasGetHistItems()) {
|
|
|
|
|
|
|
+ if ($this->loadSchema() && method_exists($this->_schemaClass, 'hasGetHistItems') && $this->_schemaClass->hasGetHistItems()) {
|
|
|
return $this->_schemaClass->getHistItems($primaryKey);
|
|
return $this->_schemaClass->getHistItems($primaryKey);
|
|
|
}
|
|
}
|
|
|
$ds = $this->getDataSource();
|
|
$ds = $this->getDataSource();
|
|
@@ -1660,7 +1661,7 @@ class TableAcl extends Core_AclBase {
|
|
|
}
|
|
}
|
|
|
$itemPatchChecked[$primaryKeyField] = $primaryKey;
|
|
$itemPatchChecked[$primaryKeyField] = $primaryKey;
|
|
|
|
|
|
|
|
- if ($this->_schemaClass && method_exists($this->_schemaClass, 'hasUpdateItem') && $this->_schemaClass->hasUpdateItem()) {
|
|
|
|
|
|
|
+ if ($this->loadSchema() && method_exists($this->_schemaClass, 'hasUpdateItem') && $this->_schemaClass->hasUpdateItem()) {
|
|
|
$affected = $this->_schemaClass->updateItem($itemPatchChecked);
|
|
$affected = $this->_schemaClass->updateItem($itemPatchChecked);
|
|
|
} else {
|
|
} else {
|
|
|
$ds = $this->getDataSource();
|
|
$ds = $this->getDataSource();
|
|
@@ -1721,7 +1722,7 @@ class TableAcl extends Core_AclBase {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public function getPrimaryKeyField() {
|
|
public function getPrimaryKeyField() {
|
|
|
- if ($this->_schemaClass) {
|
|
|
|
|
|
|
+ if ($this->loadSchema()) {
|
|
|
$pkField = $this->_schemaClass->getPrimaryKeyField();
|
|
$pkField = $this->_schemaClass->getPrimaryKeyField();
|
|
|
if ($pkField) return $pkField;
|
|
if ($pkField) return $pkField;
|
|
|
}
|
|
}
|
|
@@ -1886,7 +1887,7 @@ class TableAcl extends Core_AclBase {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public function getXsdFieldType($fieldName) {// @returns string - xsd type, TODO: throw Exception when field not found
|
|
public function getXsdFieldType($fieldName) {// @returns string - xsd type, TODO: throw Exception when field not found
|
|
|
- if ($this->_schemaClass) {
|
|
|
|
|
|
|
+ if ($this->loadSchema()) {
|
|
|
$schemaType = $this->_schemaClass->getType($fieldName);
|
|
$schemaType = $this->_schemaClass->getType($fieldName);
|
|
|
if ($schemaType) return $schemaType;
|
|
if ($schemaType) return $schemaType;
|
|
|
}
|
|
}
|
|
@@ -1911,7 +1912,7 @@ class TableAcl extends Core_AclBase {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public function getXsdFieldParam($fieldName, $paramKey) {
|
|
public function getXsdFieldParam($fieldName, $paramKey) {
|
|
|
- return ($this->_schemaClass)
|
|
|
|
|
|
|
+ return ($this->loadSchema())
|
|
|
? $this->_schemaClass->getFieldParam($fieldName, $paramKey)
|
|
? $this->_schemaClass->getFieldParam($fieldName, $paramKey)
|
|
|
: null
|
|
: null
|
|
|
;
|
|
;
|