【发布时间】:2021-08-26 23:33:30
【问题描述】:
我正在尝试使用 Search_api_solr v4.1、Solarium v6.0 和 symfony/event-dispatcher v3.4.47 启动客户端,但我不断收到 TypeError。
TypeError: Argument 2 passed to Solarium\Core\Client\Client::__construct()
must be an instance of Psr\EventDispatcher\EventDispatcherInterface,
instance of Symfony\Component\EventDispatcher\EventDispatcher given
当日光浴室的所有文档都说要使用 Symfony\Component\EventDispatcher\EventDispatcher 时,我不太确定为什么它会期待 Psr\EventDispatcher\EventDispatcherInterface 的实例。
我的适配器和事件调度器如下
use Solarium\Client;
use Solarium\Core\Client\Adapter\Curl;
use Symfony\Component\EventDispatcher\EventDispatcher;
function get_search_query() {
$adapter = new Curl();
$eventDispatcher = new EventDispatcher();
$config = ['endpoint' => ['localhost' => [
'host' => $id,
'port' => $port,
'path' => '/',
'collection' => '$core',],],];
$search = new Client($adapter, $eventDispatcher, $config);
$query = $search->createSelect();
}
有没有其他人遇到过这个问题或知道解决这个问题的方法?
【问题讨论】:
标签: symfony drupal drupal-8 solarium