Problem/Motivation
The Drush command,
drush errp paragraph
produces the error,
> ArgumentCountError: Too few arguments to function Drupal\search_api\Utility\FieldsHelper::__construct(), 4 passed in /web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 259 and exactly 5 expected in /web/modules/contrib/search_api/src/Utility/FieldsHelper.php on line 87
#0 /web/core/lib/Drupal/Component/DependencyInjection/Container.php(259): Drupal\search_api\Utility\FieldsHelper->__construct()
> #1 /web/core/lib/Drupal/Component/DependencyInjection/Container.php(177): Drupal\Component\DependencyInjection\Container->createService()
> #2 /web/modules/contrib/search_api/src/Plugin/search_api/datasource/ContentEntity.php(169): Drupal\Component\DependencyInjection\Container->get()
> #3 /web/core/lib/Drupal/Core/Plugin/Factory/ContainerFactory.php(21): Drupal\search_api\Plugin\search_api\datasource\ContentEntity::create()
> #4 /web/core/lib/Drupal/Component/Plugin/PluginManagerBase.php(83): Drupal\Core\Plugin\Factory\ContainerFactory->createInstance()
> #5 /web/modules/contrib/search_api/src/Utility/PluginHelper.php(78): Drupal\Component\Plugin\PluginManagerBase->createInstance()
> #6 /web/modules/contrib/search_api/src/Utility/PluginHelper.php(120): Drupal\search_api\Utility\PluginHelper->createIndexPlugin()
> #7 /web/modules/contrib/search_api/src/Utility/PluginHelper.php(151): Drupal\search_api\Utility\PluginHelper->createIndexPlugins()
> #8 /web/modules/contrib/search_api/src/Entity/Index.php(340): Drupal\search_api\Utility\PluginHelper->createDatasourcePlugins()
> #9 /web/modules/contrib/search_api/src/Entity/Index.php(357): Drupal\search_api\Entity\Index->getDatasources()
> #10 /web/modules/contrib/search_api/src/Plugin/search_api/datasource/ContentEntityTrackingManager.php(251): Drupal\search_api\Entity\Index->isValidDatasource()
> #11 /web/modules/contrib/search_api/src/Plugin/search_api/datasource/ContentEntityTrackingManager.php(204): Drupal\search_api\Plugin\search_api\datasource\ContentEntityTrackingManager->getIndexesForEntity()
> #12 /web/modules/contrib/search_api/search_api.module(251): Drupal\search_api\Plugin\search_api\datasource\ContentEntityTrackingManager->entityDelete()
> #13 [internal function]: search_api_entity_delete()
> #14 /web/core/lib/Drupal/Core/Extension/ModuleHandler.php(409): call_user_func_array()
> #15 /web/core/lib/Drupal/Core/Extension/ModuleHandler.php(388): Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}()
> #16 /web/core/lib/Drupal/Core/Extension/ModuleHandler.php(416): Drupal\Core\Extension\ModuleHandler->invokeAllWith()
> #17 /web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(217): Drupal\Core\Extension\ModuleHandler->invokeAll()
> #18 /web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(900): Drupal\Core\Entity\EntityStorageBase->invokeHook()
> #19 /web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(462): Drupal\Core\Entity\ContentEntityStorageBase->invokeHook()
> #20 /web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(753): Drupal\Core\Entity\EntityStorageBase->delete()
> #21 /web/core/lib/Drupal/Core/Entity/EntityBase.php(347): Drupal\Core\Entity\Sql\SqlContentEntityStorage->delete()
> #22 /web/modules/contrib/entity_reference_revisions/src/EntityReferenceRevisionsOrphanPurger.php(134): Drupal\Core\Entity\EntityBase->delete()
> #23 /web/modules/contrib/entity_reference_revisions/src/EntityReferenceRevisionsOrphanPurger.php(199): Drupal\entity_reference_revisions\EntityReferenceRevisionsOrphanPurger->deleteUnusedRevision()
> #24 /web/modules/contrib/entity_reference_revisions/entity_reference_revisions.module(301): Drupal\entity_reference_revisions\EntityReferenceRevisionsOrphanPurger->deleteOrphansBatchOperation()
> #25 /vendor/drush/drush/includes/batch.inc(245): _entity_reference_revisions_orphan_purger_batch_dispatcher()
> #26 /vendor/drush/drush/includes/batch.inc(192): _drush_batch_worker()
> #27 /vendor/drush/drush/includes/batch.inc(75): _drush_batch_command()
> #28 /vendor/drush/drush/src/Commands/core/BatchCommands.php(25): drush_batch_command()
> #29 [internal function]: Drush\Commands\core\BatchCommands->process()
> #30 /vendor/consolidation/annotated-command/src/CommandProcessor.php(276): call_user_func_array()
> #31 /vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback()
> #32 /vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter()
> #33 /vendor/consolidation/annotated-command/src/AnnotatedCommand.php(391): Consolidation\AnnotatedCommand\CommandProcessor->process()
> #34 /vendor/symfony/console/Command/Command.php(326): Consolidation\AnnotatedCommand\AnnotatedCommand->execute()
> #35 /vendor/symfony/console/Application.php(1081): Symfony\Component\Console\Command\Command->run()
> #36 /vendor/symfony/console/Application.php(320): Symfony\Component\Console\Application->doRunCommand()
> #37 /vendor/symfony/console/Application.php(174): Symfony\Component\Console\Application->doRun()
> #38 /vendor/drush/drush/src/Runtime/Runtime.php(110): Symfony\Component\Console\Application->run()
> #39 /vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun()
> #40 /vendor/drush/drush/drush.php(139): Drush\Runtime\Runtime->run()
> #41 /vendor/drush/drush/drush(4): require('...')
> #42 /vendor/bin/drush(120): include('...')
> #43 {main}
> [warning] Drush command terminated abnormally.
In ProcessBase.php line 171:
Unable to decode output into JSON: Syntax error
ArgumentCountError: Too few arguments to function Drupal\search_api\Utility\FieldsHelper::__construct(),
4 passed in /web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 259
and exactly 5 expected in Drupal\search_api\Utility\FieldsHelper->__construct()
(line 87 of /web/modules/contrib/search_api/src/Utility/FieldsHelper.php).
drush cr
solves this problem.
(The change below using array []
instead for arguments of the service search_api.fields_helper
in file search_api.services.yml
solves the problem, the Drush command then applies correctly,
> [notice] Checked Paragraph revisions for orphans: 50 of 1087 in 0 s (0 deleted)
> [notice] Checked Paragraph revisions for orphans: 100 of 1087 in 0 s (10 deleted)
...
> [notice] Checked Paragraph revisions for orphans: 1087 of 1087 in 0 s (100 deleted)
> [notice] Message: Paragraph: Deleted 100 revisions (100 entities) in 0 s.
>
)
Steps to reproduce
Drupal 10.1.5, Drush 12.3.0.0, Search API 8.x-1.30.
Install and enable modules Entity Reference Revisions and Paragraphs.
Use command drush errp paragraph
or drush err:purge paragraph
.
Proposed resolution
Cache rebuild after an upgrade to version 8.x-1.30.
(The change in file search_api.services.yml
,
search_api.fields_helper:
class: Drupal\search_api\Utility\FieldsHelper
arguments:
- '@entity_type.manager'
- '@entity_field.manager'
- '@entity_type.bundle.info'
- '@search_api.data_type_helper'
- '@search_api.theme_switcher'
->
search_api.fields_helper:
class: Drupal\search_api\Utility\FieldsHelper
arguments: ['@entity_type.manager', '@entity_field.manager', '@entity_type.bundle.info', '@search_api.data_type_helper', '@search_api.theme_switcher']
)
Remaining tasks