mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-22 18:03:37 +02:00
Fixed issue with StructuralEntityType, which was always empty after reloading the page.
We now use the id as option value, this causes that the entities are not compared via ===, but via their id.
This commit is contained in:
parent
e7cc53f046
commit
6da2057a7e
1 changed files with 3 additions and 3 deletions
|
@ -50,6 +50,7 @@ use Symfony\Component\Form\FormInterface;
|
|||
use Symfony\Component\Form\FormView;
|
||||
use Symfony\Component\OptionsResolver\Options;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\Validator\Constraints\Choice;
|
||||
use function foo\func;
|
||||
|
||||
/**
|
||||
|
@ -87,6 +88,7 @@ class StructuralEntityType extends AbstractType
|
|||
'show_fullpath_in_subtext' => true, //When this is enabled, the full path will be shown in subtext
|
||||
'subentities_of' => null, //Only show entities with the given parent class
|
||||
'disable_not_selectable' => false, //Disable entries with not selectable property
|
||||
'choice_value' => 'id', //Use the element id as option value and for comparing items
|
||||
'choice_loader' => function (Options $options) {
|
||||
return new CallbackChoiceLoader(function () use ($options) {
|
||||
return $this->getEntries($options);
|
||||
|
@ -249,8 +251,6 @@ class StructuralEntityType extends AbstractType
|
|||
return null;
|
||||
}
|
||||
|
||||
$entity = $this->em->find($options['class'], $value->getID());
|
||||
|
||||
return $entity;
|
||||
return $this->em->find($options['class'], $value->getID());
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue