mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-07-29 20:51:47 +00:00
Reworked info provider system to merge all provider metadata into a unified DTO
This commit is contained in:
parent
661cc5a052
commit
071ffe322d
39 changed files with 412 additions and 533 deletions
|
|
@ -66,8 +66,8 @@ class ProviderSelectType extends AbstractType
|
|||
|
||||
$tmp = [];
|
||||
foreach ($providers as $provider) {
|
||||
$name = $provider->getProviderInfo()['name'];
|
||||
$tmp[$name] = $provider->getProviderKey();
|
||||
$info = $provider->getProviderInfo();
|
||||
$tmp[$info->name] = $info->key;
|
||||
}
|
||||
|
||||
return $tmp;
|
||||
|
|
@ -77,7 +77,7 @@ class ProviderSelectType extends AbstractType
|
|||
$resolver->setDefault('choice_label', function (Options $options) {
|
||||
if ('object' === $options['input']) {
|
||||
return ChoiceList::label($this, static fn(?InfoProviderInterface $choice
|
||||
) => new StaticMessage($choice?->getProviderInfo()['name']));
|
||||
) => new StaticMessage($choice?->getProviderInfo()->name));
|
||||
}
|
||||
|
||||
return static fn($choice, $key, $value) => new StaticMessage($key);
|
||||
|
|
@ -85,7 +85,7 @@ class ProviderSelectType extends AbstractType
|
|||
$resolver->setDefault('choice_value', function (Options $options) {
|
||||
if ('object' === $options['input']) {
|
||||
return ChoiceList::value($this,
|
||||
static fn(?InfoProviderInterface $choice) => $choice?->getProviderKey());
|
||||
static fn(?InfoProviderInterface $choice) => $choice?->getProviderInfo()->key);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue