N°4792 - memory limit is reached when an AttributeExternalKey is pointing to a class with an AttributeBlob (#322)

N°4792 - memory limit is reached when an AttributeExternalKey is poin…
This commit is contained in:
Eric Espié
2022-08-09 09:17:15 +02:00
committed by GitHub
parent 80fa4ec71f
commit de5fee8876
2 changed files with 21 additions and 0 deletions

View File

@@ -211,14 +211,23 @@ class UIExtKeyWidget
$sClassAllowed = $oAllowedValues->GetClass();
$bAddingValue = false;
// N°4792 - load only the required fields
$aFieldsToLoad = [];
$aComplementAttributeSpec = MetaModel::GetNameSpec($oAllowedValues->GetClass(), FriendlyNameType::COMPLEMENTARY);
$sFormatAdditionalField = $aComplementAttributeSpec[0];
$aAdditionalField = $aComplementAttributeSpec[1];
if (count($aAdditionalField) > 0) {
$bAddingValue = true;
$aFieldsToLoad[$sClassAllowed] = $aAdditionalField;
}
$sObjectImageAttCode = MetaModel::GetImageAttributeCode($sClassAllowed);
if (!empty($sObjectImageAttCode)) {
$aFieldsToLoad[$sClassAllowed][] = $sObjectImageAttCode;
}
$aFieldsToLoad[$sClassAllowed][] = 'friendlyname';
$oAllowedValues->OptimizeColumnLoad($aFieldsToLoad);
$bInitValue = false;
while ($oObj = $oAllowedValues->Fetch()) {
$aOption = [];