mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 09:35:49 +02:00
Fixed problems with dynamically adding structural entities, when the arrows had spaces around them
Related to #538
This commit is contained in:
parent
cf39e1f259
commit
91e8711fdf
1 changed files with 15 additions and 0 deletions
|
@ -156,5 +156,20 @@ class StructuralEntityChoiceLoader extends AbstractChoiceLoader
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function doLoadChoicesForValues(array $values, ?callable $value): array
|
||||||
|
{
|
||||||
|
// Normalize the data (remove whitespaces around the arrow sign) and leading/trailing whitespaces
|
||||||
|
// This is required so that the value that is generated for an new entity based on its name structure is
|
||||||
|
// the same as the value that is generated for the same entity after it is persisted.
|
||||||
|
// Otherwise, errors occurs that the element could not be found.
|
||||||
|
foreach ($values as &$data) {
|
||||||
|
$data = trim($data);
|
||||||
|
$data = preg_replace('/\s*->\s*/', '->', $data);
|
||||||
|
}
|
||||||
|
unset ($data);
|
||||||
|
|
||||||
|
return $this->loadChoiceList($value)->getChoicesForValues($values);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue