Problem/Motivation
I found this issue after updating Search API Sort to the latest version 1.0.0, but I still had Search API in the version 1.15.0.
When I tried to import configuration, I had the following error:
PHP TypeError: Argument 4 passed to Drupal\search_api_sorts\SearchApiSortsManager::__construct() must be an instance of Drupal\search_api\Display\DisplayPluginManagerInterface, instance of Drupal\search_api\Display\DisplayPluginManager given, called in /(...)/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php on line 259 in /(...)/docroot/modules/contrib/search_api_sorts/src/SearchApiSortsManager.php on line 58
PHP Stack trace:
PHP 1. {main}() /(...)/vendor/drush/drush/drush:0
PHP 2. require() /(...)/vendor/drush/drush/drush:4
PHP 3. Drush\Runtime\Runtime->run() /(...)/vendor/drush/drush/drush.php:72
PHP 4. Drush\Runtime\Runtime->doRun() /(...)/vendor/drush/drush/src/Runtime/Runtime.php:48
PHP 5. Drush\Application->run() /(...)/vendor/drush/drush/src/Runtime/Runtime.php:118
PHP 6. Drush\Application->doRun() /(...)/vendor/symfony/console/Application.php:148
PHP 7. Drush\Application->doRunCommand() /(...)/vendor/symfony/console/Application.php:255
PHP 8. Consolidation\AnnotatedCommand\AnnotatedCommand->run() /(...)/vendor/symfony/console/Application.php:1010
PHP 9. Consolidation\AnnotatedCommand\AnnotatedCommand->execute() /(...)/vendor/symfony/console/Command/Command.php:255
PHP 10. Consolidation\AnnotatedCommand\CommandProcessor->process() /(...)/vendor/consolidation/annotated-command/src/AnnotatedCommand.php:302
PHP 11. Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter() /(...)/vendor/consolidation/annotated-command/src/CommandProcessor.php:176
PHP 12. Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback() /(...)/vendor/consolidation/annotated-command/src/CommandProcessor.php:212
PHP 13. call_user_func_array:{/(...)/vendor/consolidation/annotated-command/src/CommandProcessor.php:257}() /(...)/vendor/consolidation/annotated-command/src/CommandProcessor.php:257
PHP 14. Drush\Drupal\Commands\config\ConfigImportCommands->import() /(...)/vendor/consolidation/annotated-command/src/CommandProcessor.php:257
PHP 15. drush_op() /(...)/vendor/drush/drush/src/Drupal/Commands/config/ConfigImportCommands.php:307
PHP 16. drush_call_user_func_array() /(...)/vendor/drush/drush/includes/drush.inc:197
PHP 17. Drush\Drupal\Commands\config\ConfigImportCommands->doImport() /(...)/vendor/drush/drush/includes/drush.inc:206
PHP 18. Drupal\Core\Config\ConfigImporter->doSyncStep() /(...)/vendor/drush/drush/src/Drupal/Commands/config/ConfigImportCommands.php:336
PHP 19. Drupal\Core\Config\ConfigImporter->processConfigurations() /(...)/docroot/core/lib/Drupal/Core/Config/ConfigImporter.php:514
PHP 20. Drupal\Core\Config\ConfigImporter->processConfiguration() /(...)/docroot/core/lib/Drupal/Core/Config/ConfigImporter.php:610
PHP 21. Drupal\Core\Config\ConfigImporter->importInvokeOwner() /(...)/docroot/core/lib/Drupal/Core/Config/ConfigImporter.php:783
PHP 22. Drupal\search_api\Entity\SearchApiConfigEntityStorage->importUpdate() /(...)/docroot/core/lib/Drupal/Core/Config/ConfigImporter.php:997
PHP 23. Drupal\search_api\Entity\Index->save() /(...)/docroot/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php:379
PHP 24. Drupal\search_api\Entity\Index->save() /(...)/docroot/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php:616
PHP 25. Drupal\search_api\Entity\SearchApiConfigEntityStorage->save() /(...)/docroot/core/lib/Drupal/Core/Entity/EntityBase.php:395
PHP 26. Drupal\search_api\Entity\SearchApiConfigEntityStorage->save() /(...)/docroot/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php:263
PHP 27. Drupal\search_api\Entity\SearchApiConfigEntityStorage->doPostSave() /(...)/docroot/core/lib/Drupal/Core/Entity/EntityStorageBase.php:460
PHP 28. Drupal\search_api\Entity\SearchApiConfigEntityStorage->invokeHook() /(...)/docroot/modules/contrib/search_api/src/Entity/SearchApiConfigEntityStorage.php:52
PHP 29. Drupal\Core\Extension\ModuleHandler->invokeAll() /(...)/docroot/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php:347
PHP 30. call_user_func_array:{/(...)/docroot/core/lib/Drupal/Core/Extension/ModuleHandler.php:403}() /(...)/docroot/core/lib/Drupal/Core/Extension/ModuleHandler.php:403
PHP 31. search_api_sorts_search_api_index_update() /(...)/docroot/core/lib/Drupal/Core/Extension/ModuleHandler.php:403
PHP 32. Drupal::service() /(...)/docroot/modules/contrib/search_api_sorts/search_api_sorts.module:76
PHP 33. Drupal\Core\DependencyInjection\Container->get() /(...)/docroot/core/lib/Drupal.php:158
PHP 34. Drupal\Core\DependencyInjection\Container->createService() /(...)/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php:173
PHP 35. Drupal\search_api_sorts\SearchApiSortsManager->__construct() /(...)/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php:259
After debugging it, I noticed it was actually a problem in that old version of Search API I had, where DisplayPluginManager did not implement DisplayPluginManagerInterface. That was fixed in https://www.drupal.org/node/3118224 and committed in the version 1.16.0 (https://www.drupal.org/project/search_api/releases/8.x-1.16).
The issue here is that the version of the module Search API that is in the dependencies section in the info.yml file is currently set as (>=1.14). The dependency needs to be adjusted.
Steps to reproduce
Setup an environment where Search API Sorts is in the version 1.0.0 and Search API in the version 1.15 or older. Make a configuration change for Search API, in one of its configuration files. Try to import configuration using Drush `drush cim`.
Proposed resolution
Adjust the minimum version of Search API in the dependencies section to (>=1.16).
Remaining tasks
N/A
User interface changes
N/A
API changes
N/A
Data model changes
N/A
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | search_api_sorts-fix_search_api_dependency_version-3229475-2.patch | 332 bytes | maursilveira |
Comments
Comment #2
maursilveira commentedHere is a patch for this issue.
Comment #3
maursilveira commentedComment #4
maursilveira commentedComment #5
jeroentComment #7
jeroentCommitted and pushed to 8.x-1.x. Thanks!