From de5fee8876cb9b432b639895a49af1457dd0f1bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eric=20Espi=C3=A9?= Date: Tue, 9 Aug 2022 09:17:15 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B04792=20-=20memory=20limit=20is=20reached?= =?UTF-8?q?=20when=20an=20AttributeExternalKey=20is=20pointing=20to=20a=20?= =?UTF-8?q?class=20with=20an=20AttributeBlob=20(#322)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit N°4792 - memory limit is reached when an AttributeExternalKey is poin… --- application/ui.extkeywidget.class.inc.php | 9 +++++++++ core/dbsearch.class.php | 12 ++++++++++++ 2 files changed, 21 insertions(+) diff --git a/application/ui.extkeywidget.class.inc.php b/application/ui.extkeywidget.class.inc.php index b94a9bb96..80c6c8be9 100644 --- a/application/ui.extkeywidget.class.inc.php +++ b/application/ui.extkeywidget.class.inc.php @@ -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 = []; diff --git a/core/dbsearch.class.php b/core/dbsearch.class.php index f532fb839..74e4feb7f 100644 --- a/core/dbsearch.class.php +++ b/core/dbsearch.class.php @@ -1724,4 +1724,16 @@ abstract class DBSearch { $this->SetShowObsoleteData(utils::ShowObsoleteData()); } + + /** + * To ease the debug of filters + * @internal + * + * @return string + * + */ + public function __toString() + { + return $this->ToOQL(); + } }