Skip to content

Commit

Permalink
Update AutocompleteService.php
Browse files Browse the repository at this point in the history
  • Loading branch information
SebLevDev authored Oct 28, 2024
1 parent 01ffc3c commit e8de9f4
Showing 1 changed file with 5 additions and 21 deletions.
26 changes: 5 additions & 21 deletions Service/AutocompleteService.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,17 @@

class AutocompleteService
{
/**
* @var FormFactoryInterface
*/
private $formFactory;

/**
* @var ManagerRegistry
*/
private $doctrine;

/**
* @param FormFactoryInterface $formFactory
* @param ManagerRegistry $doctrine
*/
private FormFactoryInterface $formFactory;

private ManagerRegistry $doctrine;

public function __construct(FormFactoryInterface $formFactory, ManagerRegistry $doctrine)
{
$this->formFactory = $formFactory;
$this->doctrine = $doctrine;
}

/**
* @param Request $request
* @param string|FormTypeInterface $type
*
* @return array
*/
public function getAutocompleteResults(Request $request, $type)
public function getAutocompleteResults(Request $request, string|FormTypeInterface $type): array
{
$form = $this->formFactory->create($type);
$fieldOptions = $form->get($request->get('field_name'))->getConfig()->getOptions();
Expand Down

0 comments on commit e8de9f4

Please sign in to comment.