public function __construct(private readonly EntityRepository
$languageRepository,
private readonly EventDispatcherInterface
$eventDispatcher) { } public function getLanguages(Context
$context): LanguageCollection
{ $criteria =
new Criteria();
$criteria->
addFilter(new NandFilter([new EqualsFilter('salesChannels.id', null
)]));
$criteria->
addSorting(new FieldSorting('id'
));
$this->eventDispatcher->
dispatch(new ElasticsearchIndexerLanguageCriteriaEvent($criteria,
$context));
/** @var LanguageCollection $languages */
$languages =
$this->languageRepository
->
search($criteria,
$context) ->
getEntities();
return $languages;
}}