|
|
@@ -91,9 +91,12 @@ class Schema_PrzypomnijStorageAcl extends Core_AclSimpleSchemaBase {
|
|
|
");
|
|
|
}
|
|
|
|
|
|
- public function __construct() {
|
|
|
+ function __construct() {
|
|
|
parent::__construct($this->_simpleSchema);
|
|
|
$this->idUser = User::getID(); // default - current user
|
|
|
+ }
|
|
|
+
|
|
|
+ function onBeforeFetchData() {
|
|
|
self::updateCacheIfNeeded();
|
|
|
}
|
|
|
|
|
|
@@ -269,7 +272,7 @@ class Schema_PrzypomnijStorageAcl extends Core_AclSimpleSchemaBase {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // public function getTotal($params = []) {
|
|
|
+ // function getTotal($params = []) {
|
|
|
// self::updateCacheIfNeeded();
|
|
|
// $sqlWhere = $this->_parseWhere($params);
|
|
|
// return DB::getPDO()->fetchValue("
|
|
|
@@ -278,7 +281,7 @@ class Schema_PrzypomnijStorageAcl extends Core_AclSimpleSchemaBase {
|
|
|
// {$sqlWhere}
|
|
|
// ");
|
|
|
// }
|
|
|
- // public function getItem($pk, $params = []) {
|
|
|
+ // function getItem($pk, $params = []) {
|
|
|
// self::updateCacheIfNeeded();
|
|
|
// if (!$pk) throw new Exception("Missing primary key '{$this->_namespace}'");
|
|
|
// $pkField = $this->getSqlPrimaryKeyField();
|
|
|
@@ -292,7 +295,7 @@ class Schema_PrzypomnijStorageAcl extends Core_AclSimpleSchemaBase {
|
|
|
// return $this->buildFeatureFromSqlRow($item, $params);
|
|
|
// }
|
|
|
//
|
|
|
- // public function getItems($params = []) {
|
|
|
+ // function getItems($params = []) {
|
|
|
// self::updateCacheIfNeeded();
|
|
|
// $sqlWhere = $this->_parseWhere($params);
|
|
|
//
|
|
|
@@ -329,12 +332,12 @@ class Schema_PrzypomnijStorageAcl extends Core_AclSimpleSchemaBase {
|
|
|
// }, $query->fetchAll());
|
|
|
// }
|
|
|
|
|
|
- public function buildQuery($params = array()) {
|
|
|
+ function buildQuery($params = array()) {
|
|
|
Lib::loadClass('AclQueryFeatures');
|
|
|
return new AclQueryFeatures($this, $params, $legacyMode = false);
|
|
|
}
|
|
|
|
|
|
- public function _parseWhere($params = []) {
|
|
|
+ function _parseWhere($params = []) {
|
|
|
$sqlWhere = [];
|
|
|
DBG::log($params, 'array', "SystemObject::_parseWhere");
|
|
|
// if (!empty($params['#refFrom'])) {
|
|
|
@@ -386,7 +389,7 @@ class Schema_PrzypomnijStorageAcl extends Core_AclSimpleSchemaBase {
|
|
|
return (!empty($sqlWhere)) ? "where " . implode(" and ", $sqlWhere) : '';
|
|
|
}
|
|
|
|
|
|
- public function buildFeatureFromSqlRow($item, $params = []) {
|
|
|
+ function buildFeatureFromSqlRow($item, $params = []) {
|
|
|
// DBG::log($params, 'array', "buildFeatureFromSqlRow... '{$item['namespace']}'");
|
|
|
// $exNs = explode('/', $item['namespace']);
|
|
|
// $item['name'] = array_pop($exNs);
|
|
|
@@ -413,7 +416,7 @@ class Schema_PrzypomnijStorageAcl extends Core_AclSimpleSchemaBase {
|
|
|
return $item;
|
|
|
}
|
|
|
|
|
|
- // public function updateItem($itemPatch) { // @required [ 'namespace' => ... ] (primaryKey)
|
|
|
+ // function updateItem($itemPatch) { // @required [ 'namespace' => ... ] (primaryKey)
|
|
|
// $pkField = $this->getPrimaryKeyField();
|
|
|
// $pk = V::get($pkField, null, $itemPatch);
|
|
|
// if (null === $pk) throw new Exception("BUG missing primary key field for '{$this->_namespace}' updateItem");
|