Affected Version
2026.2
Affected capability
Data Objects
Steps to reproduce
Reproduced with pimcore/studio-backend-bundle v2026.1.6 + studio-ui-bundle v2026.1.6. The affected code is byte-identical in v2026.2.8 and on the 2026.x branch (last change to the file: July 2025), so the bug is still present on the latest release. Sub-area: data object listing → batch edit → advanced relations (advancedManyToManyObjectRelation, advancedManyToManyRelation).
- Create a class
Item and a class Container with a field items of type Advanced Many-To-Many Object Relation (allowed class Item, one metadata column, e.g. text column note).
- Create items
X, Y, Z and a container A with items = [X, Y]. Save.
- Open the listing of the folder containing
A, select A, open Batch edit, add the field items.
- Choose mode "Add" (
batch-edit.append-mode.add), select Z, run the batch edit.
- Open
A again.
Actual Behavior
A.items now contains only Z. X and Y are gone. Mode "Remove" with Z empties the field completely (X and Y are removed although they were not part of the removal set). Mode "Replace" behaves as expected. The same batch edit on a plain manyToManyObjectRelation field appends/removes correctly.
Root cause: RelationDataService::getRelationExistingData() returns the wrong variable for advanced relations. The loop normalises $existingValues in place, but the method returns $existingData, which is still the empty array it was initialised with:
https://github.com/pimcore/studio-backend-bundle/blob/4e0e689be2cbafdb2462c43a41a5f22a8b435e0d/src/DataObject/Service/Data/RelationDataService.php#L109-L127
private function getRelationExistingData(array $existingValues, bool $isAdvanced): array
{
$existingData =[];
if ($isAdvanced) {
foreach ($existingValues as $index => $existingRelation) {
$existingValues[$index][ElementTypes::TYPE_ELEMENT] = $this->getExistingElementData(
$existingRelation[ElementTypes::TYPE_ELEMENT]
);
}
return $existingData; // always []
}
...
}
PatchService::handlePatchDataField() therefore receives an empty $existingValues for every advanced relation. ADD becomes "set to the new entries only", REMOVE becomes "set to empty". The non-advanced branch of the same method (below the if) fills $existingData correctly, which is why plain relations are unaffected.
Expected Behavior
"Add" appends the selected elements to the existing relations, keeping existing metadata. "Remove" removes only the selected elements. Both consistent with the plain manyToManyObjectRelation behaviour and with Pimcore\Model\DataObject\ClassDefinition\Data\Relations\AbstractRelations::appendData() / removeData() in core.
One-line fix in the advanced branch:
Affected Version
2026.2
Affected capability
Data Objects
Steps to reproduce
Reproduced with pimcore/studio-backend-bundle v2026.1.6 + studio-ui-bundle v2026.1.6. The affected code is byte-identical in v2026.2.8 and on the
2026.xbranch (last change to the file: July 2025), so the bug is still present on the latest release. Sub-area: data object listing → batch edit → advanced relations (advancedManyToManyObjectRelation,advancedManyToManyRelation).Itemand a classContainerwith a fielditemsof type Advanced Many-To-Many Object Relation (allowed classItem, one metadata column, e.g. text columnnote).X,Y,Zand a containerAwithitems = [X, Y]. Save.A, selectA, open Batch edit, add the fielditems.batch-edit.append-mode.add), selectZ, run the batch edit.Aagain.Actual Behavior
A.itemsnow contains onlyZ.XandYare gone. Mode "Remove" withZempties the field completely (XandYare removed although they were not part of the removal set). Mode "Replace" behaves as expected. The same batch edit on a plainmanyToManyObjectRelationfield appends/removes correctly.Root cause:
RelationDataService::getRelationExistingData()returns the wrong variable for advanced relations. The loop normalises$existingValuesin place, but the method returns$existingData, which is still the empty array it was initialised with:https://github.com/pimcore/studio-backend-bundle/blob/4e0e689be2cbafdb2462c43a41a5f22a8b435e0d/src/DataObject/Service/Data/RelationDataService.php#L109-L127
PatchService::handlePatchDataField()therefore receives an empty$existingValuesfor every advanced relation.ADDbecomes "set to the new entries only",REMOVEbecomes "set to empty". The non-advanced branch of the same method (below theif) fills$existingDatacorrectly, which is why plain relations are unaffected.Expected Behavior
"Add" appends the selected elements to the existing relations, keeping existing metadata. "Remove" removes only the selected elements. Both consistent with the plain
manyToManyObjectRelationbehaviour and withPimcore\Model\DataObject\ClassDefinition\Data\Relations\AbstractRelations::appendData()/removeData()in core.One-line fix in the advanced branch: