소스 검색

fixed primaryKey in AntAclBase

Piotr Labudda 8 년 전
부모
커밋
b79a4e42b0
2개의 변경된 파일13개의 추가작업 그리고 2개의 파일을 삭제
  1. 11 0
      SE/se-lib/AclQueryBuilder.php
  2. 2 2
      SE/se-lib/AntAclBase.php

+ 11 - 0
SE/se-lib/AclQueryBuilder.php

@@ -432,6 +432,17 @@ class AclQueryBuilder {
 					case 'enum': return "{$prefix}.{$sqlFieldName}"; // TODO: check if local or remote
 					case 'enum': return "{$prefix}.{$sqlFieldName}"; // TODO: check if local or remote
 					case 'www_link': return "{$prefix}.{$sqlFieldName}"; // TODO: check if local or remote?
 					case 'www_link': return "{$prefix}.{$sqlFieldName}"; // TODO: check if local or remote?
 					case 'string': return "{$prefix}.{$sqlFieldName}"; // TODO: check if local or remote?
 					case 'string': return "{$prefix}.{$sqlFieldName}"; // TODO: check if local or remote?
+					case 'date':
+					case 'dateTime':
+					case 'decimal':
+					case 'double':
+					case 'float':
+					case 'hexBinary':
+					case 'polygon':
+					case 'text':
+					case 'time':
+					case 'year':
+					case 'integer': return "{$prefix}.{$sqlFieldName}"; // TODO: check if local or remote?
 					default: throw new Exception("Not implemented field type in select '{$fieldType}' (field: '{$fieldName}')");
 					default: throw new Exception("Not implemented field type in select '{$fieldType}' (field: '{$fieldName}')");
 				}
 				}
 			}
 			}

+ 2 - 2
SE/se-lib/AntAclBase.php

@@ -247,7 +247,7 @@ class AntAclBase extends Core_AclBase {
 		throw new Exception("Field not found '{$this->_namespace}/{$fieldName}'");
 		throw new Exception("Field not found '{$this->_namespace}/{$fieldName}'");
 	}
 	}
 
 
-	public function getSqlPrimaryKeyField() { return 'ID'; } // TODO: read from root object schema (_rootTableName)
+	public function getSqlPrimaryKeyField() { return $this->_primaryKey; }
 
 
 	public function getTotal($params = []) {
 	public function getTotal($params = []) {
 		DBG::log($params, 'array', "AntAclBase::getTotal params");
 		DBG::log($params, 'array', "AntAclBase::getTotal params");
@@ -315,7 +315,7 @@ class AntAclBase extends Core_AclBase {
 		$acl->_namespace = $conf['namespace'];
 		$acl->_namespace = $conf['namespace'];
 		$acl->_rootNamespace = str_replace('__x3A__', '/', $conf['nsPrefix']);
 		$acl->_rootNamespace = str_replace('__x3A__', '/', $conf['nsPrefix']);
 		$acl->_fields = $conf['field']; // TODO: lazyLoading - use getFields() in all functions - TODO: use ACL::getObjectFields
 		$acl->_fields = $conf['field']; // TODO: lazyLoading - use getFields() in all functions - TODO: use ACL::getObjectFields
-		$acl->_primaryKey = 'ID'; // $conf['primaryKey'];
+		$acl->_primaryKey = (!empty($conf['primaryKey'])) ? $conf['primaryKey'] : 'ID'; // $conf['primaryKey'];
 
 
 		$_cache[$idZasob] = $acl;
 		$_cache[$idZasob] = $acl;
 		return $_cache[$idZasob];
 		return $_cache[$idZasob];