N°2272 Fix calls to DBObjectSet::OptimizeColumnLoad() in the portal (now requires ClassAlias to always be specified)

This commit is contained in:
Molkobain
2019-11-27 10:39:24 +01:00
parent f1d0418e48
commit 603ae8c0e1
5 changed files with 23 additions and 26 deletions

View File

@@ -16,8 +16,6 @@
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
*
*
*/
namespace Combodo\iTop\Portal\Controller;
@@ -384,6 +382,7 @@ class BrowseBrickController extends BrickController
$aColumnAttrs[$sTmpClassAlias] = $aTmpColumnAttrs;
}
}
// Note: $aColumnAttrs already contains array of aliases => attcodes
$oSet->OptimizeColumnLoad($aColumnAttrs);
// Setting specified column sort, setting default datamodel one otherwise

View File

@@ -16,8 +16,6 @@
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
*
*
*/
namespace Combodo\iTop\Portal\Controller;
@@ -491,7 +489,7 @@ class ManageBrickController extends BrickController
// - Check how many records there is.
// - Update $sDataLoading with its new value regarding the number of record and the threshold
$oCountSet = new DBObjectSet($oQuery);
$oCountSet->OptimizeColumnLoad(array());
$oCountSet->OptimizeColumnLoad(array($oQuery->GetClassAlias() => array()));
$fThreshold = (float)MetaModel::GetModuleSetting($sPortalId,
'lazy_loading_threshold');
$sDataLoading = ($oCountSet->Count() > $fThreshold) ? AbstractBrick::ENUM_DATA_LOADING_LAZY : AbstractBrick::ENUM_DATA_LOADING_FULL;
@@ -555,6 +553,7 @@ class ManageBrickController extends BrickController
}
}
}
// Note: $aColumnToLoad already contains array of aliases => attcodes
$oSet->OptimizeColumnLoad($aColumnsToLoad);
$oSecurityHelper->PreloadForCache($oSet->GetFilter(),

View File

@@ -16,8 +16,6 @@
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
*
*
*/
namespace Combodo\iTop\Portal\Controller;
@@ -1245,7 +1243,7 @@ class ObjectController extends BrickController
$oSearch->AllowAllData();
}
$oSet = new DBObjectSet($oSearch, array(), $aParams);
$oSet->OptimizeColumnLoad($aObjectAttCodes);
$oSet->OptimizeColumnLoad(array($oSearch->GetClassAlias() => $aObjectAttCodes));
// Retrieving objects
while ($oObject = $oSet->Fetch())

View File

@@ -614,7 +614,7 @@ class NavigationRuleHelper
{
$oSearch = DBSearch::FromOQL($aRuleDef['properties']['oql']);
$oSet = new DBObjectSet($oSearch, array(), array('this' => $oCurrentObject));
$oSet->OptimizeColumnLoad(array());
$oSet->OptimizeColumnLoad(array($oSearch => array()));
$oTargetObject = $oSet->Fetch();
}
// - Build URL

View File

@@ -1,21 +1,22 @@
<?php
// Copyright (C) 2010-2018 Combodo SARL
//
// This file is part of iTop.
//
// iTop is free software; you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// iTop is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with iTop. If not, see <http://www.gnu.org/licenses/>
/**
* Copyright (C) 2013-2019 Combodo SARL
*
* This file is part of iTop.
*
* iTop is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* iTop is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
*/
namespace Combodo\iTop\Portal\Helper;
@@ -288,7 +289,7 @@ class SecurityHelper
// Preparing object set
$oScopeSet = new DBObjectSet($oScopeQuery);
$oScopeSet->OptimizeColumnLoad(array());
$oScopeSet->OptimizeColumnLoad(array($oScopeQuery->GetClassAlias() => array()));
// Checking objects status
$aScopeObjectIds = $aObjectIds;