Skip to content

Commit f530ac1

Browse files
committed
[Autocomplete] Fix BC and trigger deprecation for EntityAutocompleterInterface
1 parent 2e2b82d commit f530ac1

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/Autocomplete/src/AutocompleteResultsExecutor.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ public function fetchResults(EntityAutocompleterInterface $autocompleter, string
7171

7272
$results = [];
7373

74-
if (null === $groupBy = $autocompleter->getGroupBy()) {
74+
if (!method_exists($autocompleter, 'getGroupBy')) {
75+
trigger_deprecation('symfony/ux-autocomplete', '2.8', 'Not implementing the "EntityAutocompleterInterface::getGroupBy()" in "%s" is deprecated.', get_debug_type($autocompleter));
76+
} elseif (null === $groupBy = $autocompleter->getGroupBy()) {
7577
foreach ($paginator as $entity) {
7678
$results[] = [
7779
'value' => $autocompleter->getValue($entity),

src/Autocomplete/src/EntityAutocompleterInterface.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
/**
1919
* Interface for classes that will have an "autocomplete" endpoint exposed.
20+
*
21+
* @method mixed getGroupBy() Return group_by option.
2022
*/
2123
interface EntityAutocompleterInterface
2224
{
@@ -50,5 +52,5 @@ public function isGranted(Security $security): bool;
5052
/**
5153
* Return group_by option.
5254
*/
53-
public function getGroupBy(): mixed;
55+
/* public function getGroupBy(): mixed; */
5456
}

0 commit comments

Comments
 (0)