Refactor bulk import functionality to make controller smaller (use services) add DTOs and use stimulus controllers on frontend

This commit is contained in:
barisgit 2025-09-09 20:30:27 +02:00
parent 65d840c444
commit d6ac16ede0
14 changed files with 1382 additions and 716 deletions

View file

@ -54,7 +54,7 @@ class GlobalFieldMappingType extends AbstractType
]);
$builder->add('submit', SubmitType::class, [
'label' => 'info_providers.bulk_search.submit'
'label' => 'info_providers.bulk_import.search.submit'
]);
}

View file

@ -24,9 +24,7 @@ declare(strict_types=1);
namespace App\Form\InfoProviderSystem;
use App\Services\InfoProviderSystem\ProviderRegistry;
use App\Services\InfoProviderSystem\Providers\InfoProviderInterface;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\ChoiceList\ChoiceList;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\OptionsResolver\OptionsResolver;
@ -44,11 +42,16 @@ class ProviderSelectType extends AbstractType
public function configureOptions(OptionsResolver $resolver): void
{
$providers = $this->providerRegistry->getActiveProviders();
// Create a simple array of provider keys => labels
$choices = [];
foreach ($providers as $provider) {
$choices[$provider->getProviderInfo()['name']] = $provider->getProviderKey();
}
$resolver->setDefaults([
'choices' => $this->providerRegistry->getActiveProviders(),
'choice_label' => ChoiceList::label($this, static fn (?InfoProviderInterface $choice) => $choice?->getProviderInfo()['name']),
'choice_value' => ChoiceList::value($this, static fn(?InfoProviderInterface $choice) => $choice?->getProviderKey()),
'choices' => $choices,
'multiple' => true,
]);
}