advanced search: ShorthandExpansion TODOs list

SVN:b1312[5765]
This commit is contained in:
Bruno Da Silva
2018-05-02 12:19:38 +00:00
parent 81f7f9d70b
commit e508f645f3
2 changed files with 25 additions and 3 deletions

View File

@@ -1134,6 +1134,14 @@ class DBObjectSearch extends DBSearch
return $this->m_oSearchCondition->ApplyParameters(array_merge($this->m_aParams, $aArgs));
}
/**
*
* @todo: check if the clone is mandatory or optional. (the performance would be better without cloning)
*
* @param bool $bClone
*
* @return DBObjectSearch|DBSearch
*/
public function ShorthandExpansion($bClone = false)
{
if ($bClone)
@@ -1222,7 +1230,7 @@ class DBObjectSearch extends DBSearch
$this->m_oSearchCondition->Browse($callback);
//replace the ExternalFieldExpression by a FieldExpression (based on last ExternalFieldExpression::$aFields)
$this->m_oSearchCondition->Translate(array(), false, false);
$this->m_oSearchCondition->Translate(array(), false, false);//TODO: check if this call is correct
return $oDbObject;
}

View File

@@ -841,6 +841,13 @@ class FalseExpression extends ScalarExpression
}
}
/**
* Class ExternalFieldExpression
*
* @todo verify if all required methods are implemented (ie: at first I missed the `Render` method, so DBObjectSearch::toOQL() result was wrong)
*
*/
class ExternalFieldExpression extends UnaryExpression
{
/**
@@ -869,14 +876,21 @@ class ExternalFieldExpression extends UnaryExpression
return $this->m_aFields;
}
/**
* used by DBObjectSearch::ShorthandExpansion(). it result in the ExternalFieldExpression being replaced by a FieldExpression mathching the final entry in self::$m_aFields
*
* @param array $aTranslationData
* @param bool $bMatchAll
* @param bool $bMarkFieldsAsResolved
*
* @return Expression|FieldExpression|UnaryExpression
*/
public function Translate($aTranslationData, $bMatchAll = true, $bMarkFieldsAsResolved = true)
{
$aFields = $this->GetFields();
$aLastField = end($aFields);
$oRet = new FieldExpression($aLastField['sAttCode'], $aLastField['sAlias']);
// $oRet->Translate($aTranslationData, $bMatchAll, $bMarkFieldsAsResolved);
return $oRet;
}