|
|
@@ -446,12 +446,20 @@ class ACL {
|
|
|
if (!$childNamespace) throw new Exception("Missing child namespace");
|
|
|
if (!$primaryKey) throw new Exception("Missing primary key");
|
|
|
|
|
|
- $typeName = Api_WfsNs::typeName($childNamespace);
|
|
|
- $refTable = ACL::getRefTable($namespace, $typeName);
|
|
|
+ $childTypeName = Api_WfsNs::toTypeName($childNamespace);
|
|
|
+ $refConf = ACL::getRefConfig($namespace, $childTypeName);
|
|
|
+ $refTable = $refConf->tableName; // ACL::getRefTable($namespace, $childTypeName);
|
|
|
if (V::get('total', false, $params)) {
|
|
|
return DB::getPDO()->fetchValue(" select count(*) as cnt from `{$refTable}` where PRIMARY_KEY = :primary_key and A_STATUS not in ('DELETED') ", [ ':primary_key' => $primaryKey ]);
|
|
|
}
|
|
|
- throw new Exception("TODO: fetch refs from '{$namespace}' where primaryKey = '{$primaryKey}'");
|
|
|
+
|
|
|
+ return DB::getPDO()->fetchAll("
|
|
|
+ select REMOTE_PRIMARY_KEY
|
|
|
+ from `{$refConf->tableName}`
|
|
|
+ where PRIMARY_KEY = :primaryKey
|
|
|
+ and A_STATUS not in ('DELETED')
|
|
|
+ ", [ ':primaryKey' => $primaryKey ]);
|
|
|
+ // TODO: order by SORT_PRIO
|
|
|
}
|
|
|
|
|
|
public static function fetchBackRefs($namespace, $primaryKey, $parentNamespace, $params = []) { // TODO: $params: limit, total
|