public function CommandHelper::__construct in Search API 8
Constructs a CommandHelper object.
Parameters
\Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager: The entity type manager.
\Drupal\Core\Extension\ModuleHandlerInterface $module_handler: The module handler.
\Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher: The event dispatcher.
string|callable $translation_function: (optional) A callable for translating strings.
Throws
\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException Thrown if the "search_api_index" or "search_api_server" entity types' storage handlers couldn't be loaded.
\Drupal\Component\Plugin\Exception\PluginNotFoundException Thrown if the "search_api_index" or "search_api_server" entity types are unknown.
File
- src/
Utility/ CommandHelper.php, line 90
Class
- CommandHelper
- Provides functionality to be used by CLI tools.
Namespace
Drupal\search_api\UtilityCode
public function __construct(EntityTypeManagerInterface $entity_type_manager, ModuleHandlerInterface $module_handler, EventDispatcherInterface $event_dispatcher, $translation_function = 'dt') {
$this->entityTypeManager = $entity_type_manager;
$this->indexStorage = $entity_type_manager
->getStorage('search_api_index');
$this->serverStorage = $entity_type_manager
->getStorage('search_api_server');
$this->moduleHandler = $module_handler;
$this->eventDispatcher = $event_dispatcher;
$this->translationFunction = $translation_function;
}