Optimization: do not load the full set of items when it comes to displaying an autocomplete!

SVN:trunk[1275]
This commit is contained in:
Romain Quetiez
2011-06-08 13:30:56 +00:00
parent 64b4922499
commit a0900cd732
7 changed files with 123 additions and 71 deletions

View File

@@ -2339,6 +2339,7 @@ class AttributeExternalKey extends AttributeDBFieldVoid
public function GetAllowedValues($aArgs = array(), $sContains = '')
{
//throw new Exception("GetAllowedValues on ext key has been deprecated");
try
{
return parent::GetAllowedValues($aArgs, $sContains);
@@ -2351,6 +2352,13 @@ class AttributeExternalKey extends AttributeDBFieldVoid
}
}
public function GetAllowedValuesAsObjectSet($aArgs = array(), $sContains = '')
{
$oValSetDef = $this->GetValuesDef();
$oSet = $oValSetDef->ToObjectSet($aArgs, $sContains);
return $oSet;
}
public function GetDeletionPropagationOption()
{
return $this->Get("on_target_delete");

View File

@@ -353,7 +353,10 @@ class DBObjectSet
public function Rewind()
{
$this->Seek(0);
if ($this->m_bLoaded)
{
$this->Seek(0);
}
}
public function Seek($iRow)

View File

@@ -1024,6 +1024,11 @@ abstract class MetaModel
return $oFltDef->GetAllowedValues($aArgs, $sContains);
}
public static function GetAllowedValuesAsObjectSet($sClass, $sAttCode, $aArgs = array(), $sContains = '')
{
$oAttDef = self::GetAttributeDef($sClass, $sAttCode);
return $oAttDef->GetAllowedValuesAsObjectSet($aArgs, $sContains);
}
//
// Businezz model declaration verbs (should be static)
//

View File

@@ -101,6 +101,22 @@ class ValueSetObjects extends ValueSetDefinition
$this->m_bAllowAllData = $bAllowAllData;
}
public function ToObjectSet($aArgs = array(), $sContains = '')
{
if ($this->m_bAllowAllData)
{
$oFilter = DBObjectSearch::FromOQL_AllData($this->m_sFilterExpr);
}
else
{
$oFilter = DBObjectSearch::FromOQL($this->m_sFilterExpr);
}
return new DBObjectSet($oFilter, $this->m_aOrderBy, $aArgs);
}
protected function LoadValues($aArgs)
{
$this->m_aValues = array();