Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/Autocomplete/src/AutocompleteResultsExecutor.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ public function fetchResults(EntityAutocompleterInterface $autocompleter, string

$results = [];

if (null === $groupBy = $autocompleter->getGroupBy()) {
if (!method_exists($autocompleter, 'getGroupBy')) {
trigger_deprecation('symfony/ux-autocomplete', '2.8', 'Not implementing the "EntityAutocompleterInterface::getGroupBy()" in "%s" is deprecated.', get_debug_type($autocompleter));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This deprecation is not needed, the @method annotation will already trigger a similar deprecation (which is done via Symfony's DebugClassLoader).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx - got it at #808

} elseif (null === $groupBy = $autocompleter->getGroupBy()) {
foreach ($paginator as $entity) {
$results[] = [
'value' => $autocompleter->getValue($entity),
Expand Down
6 changes: 4 additions & 2 deletions src/Autocomplete/src/EntityAutocompleterInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

/**
* Interface for classes that will have an "autocomplete" endpoint exposed.
*
* @method mixed getGroupBy() Return group_by option.
*/
interface EntityAutocompleterInterface
{
Expand Down Expand Up @@ -47,8 +49,8 @@ public function getValue(object $entity): mixed;
*/
public function isGranted(Security $security): bool;

/**
/*
* Return group_by option.
*/
public function getGroupBy(): mixed;
/* public function getGroupBy(): mixed; */
}