mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-14 04:14:36 +02:00
Fixed possibility to create nested structure from the part edit page
This commit is contained in:
parent
d9e25d077d
commit
60446edd68
2 changed files with 23 additions and 28 deletions
|
@ -54,26 +54,6 @@ class StructuralEntityChoiceLoader extends AbstractChoiceLoader
|
|||
return array_merge($tmp, $this->builder->typeToNodesList($this->options['class'], null));
|
||||
}
|
||||
|
||||
/*public function loadChoicesForValues(array $values, callable $value = null)
|
||||
{
|
||||
$tmp = parent::loadChoicesForValues($values, $value);
|
||||
|
||||
if ($this->options['allow_add'] && empty($tmp)) {
|
||||
if (count($values) > 1) {
|
||||
throw new \InvalidArgumentException('Cannot add multiple entities at once.');
|
||||
}
|
||||
|
||||
//Dont create a new entity for the empty option
|
||||
if ($values[0] === "" || $values[0] === null) {
|
||||
return $tmp;
|
||||
}
|
||||
|
||||
return [$this->createNewEntitiesFromValue($values[0])[0]];
|
||||
}
|
||||
|
||||
return $tmp;
|
||||
}*/
|
||||
|
||||
public function createNewEntitiesFromValue(string $value): array
|
||||
{
|
||||
if (!$this->options['allow_add']) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue