mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-24 18:58:46 +02:00
Fix error with reindexed collectionType when multiple parts dont have IDs yet.
This commit is contained in:
parent
3bf346f756
commit
315cc30a1a
1 changed files with 3 additions and 1 deletions
|
@ -84,7 +84,9 @@ class CollectionTypeExtension extends AbstractTypeExtension
|
|||
$error_mapping = [];
|
||||
|
||||
foreach ($data->toArray() as $key => $item) {
|
||||
$index = $options['reindex_prefix'] . $this->propertyAccess->getValue($item, $options['reindex_path']);
|
||||
$id = $this->propertyAccess->getValue($item, $options['reindex_path']);
|
||||
//If element has an ID then use it. otherwise use default key
|
||||
$index = $id === null ? $key : $options['reindex_prefix'] . $id;
|
||||
$error_mapping['[' . $key . ']'] = $index;
|
||||
$reindexed_data->set($index, $item);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue