N°2250 - DisplayObject with ormLinkSet ignore Removed

This commit is contained in:
Eric Espie
2023-05-03 14:39:14 +02:00
parent 5a856f96eb
commit 4f6e74a3ee
10 changed files with 101 additions and 39 deletions

View File

@@ -26,15 +26,17 @@ class LinkSetRepository
{
/**
* LinksDbSetToTargetObjectArray.
* Get list of remote objects information based on a linkSet
*
* @param iDBObjectSetIterator $oDbObjectSet Db object set
* @param bool $bForce options with force flag will be kept event if they don't be part of the current value of set
* @param array $aInitialOptions
* @param string $sTargetClass Target class name
* @param string|null $sTargetField Target field
*
* @return array|null
*/
static public function LinksDbSetToTargetObjectArray(iDBObjectSetIterator $oDbObjectSet, string $sTargetClass, string $sTargetField = null): ?array
static public function LinksDbSetToTargetObjectArray(iDBObjectSetIterator $oDbObjectSet, bool $bForce, array &$aInitialOptions, string $sTargetClass, string $sTargetField = null): ?array
{
try {
@@ -52,9 +54,6 @@ class LinkSetRepository
$sTargetClass => $aFieldsToLoad,
]);
// Prepare result
$aResult = [];
// Iterate throw objects...
$oDbObjectSet->Rewind();
while ($oObject = $oDbObjectSet->Fetch()) {
@@ -78,16 +77,19 @@ class LinkSetRepository
// Remote key
$aObjectData['key'] = $oObject->GetKey();
// force option
$aObjectData['force'] = $bForce;
// Fill loaded columns...
foreach ($aFieldsToLoad as $sField) {
$aObjectData[$sField] = $oObject->Get($sField);
}
// Compute others data
$aResult[] = ObjectRepository::ComputeOthersData($oObject, $sTargetClass, $aObjectData, $aComplementAttributeSpec, $sObjectImageAttCode);
$aInitialOptions[$oObject->GetKey()] = ObjectRepository::ComputeOthersData($oObject, $sTargetClass, $aObjectData, $aComplementAttributeSpec, $sObjectImageAttCode);
}
return $aResult;
return $aInitialOptions;
}
catch (Exception $e) {