Custom fields: comparing two sets of values is delegated to the custom fields handler because the values must be interpreted before concluding (blind comparison resulted in objects being written though the values were equivalent)

SVN:trunk[3964]
This commit is contained in:
Romain Quetiez
2016-03-22 16:55:51 +00:00
parent ea31d71d16
commit 462af27157
2 changed files with 10 additions and 1 deletions

View File

@@ -124,4 +124,11 @@ abstract class CustomFieldsHandler
* Cleanup data upon object deletion (object id still available here)
*/
abstract public function DeleteValues();
/**
* @param $aValuesA
* @param $aValuesB
* @return bool
*/
abstract public function CompareValues($aValuesA, $aValuesB);
}

View File

@@ -96,6 +96,8 @@ class ormCustomFieldsValue
*/
public function Equals(ormCustomFieldsValue $oReference)
{
return (json_encode($this->aCurrentValues) === json_encode($oReference->aCurrentValues));
$oAttDef = MetaModel::GetAttributeDef(get_class($this->oHostObject), $this->sAttCode);
$oHandler = $oAttDef->GetHandler($this->oHostObject, $this->GetValues());
return $oHandler->CompareValues($this->aCurrentValues, $oReference->aCurrentValues);
}
}