Проблема при присвоении роли пользователю после регистрации (Модуль Rules)

Аватар пользователя dremovand dremovand 12 августа в 11:45

Собственно само правило. Не работает в равной степени как и действие "Добавить пользователю роль".

uuid: fc0c43d9-3b23-4eb8-b55d-40a4a2caf87c
langcode: ru
status: true
dependencies: {  }
id: test_rule
label: 'Test Rule'
events:
  -
    event_name: 'rules_entity_insert:user'
description: ''
tags: {  }
config_version: '3'
expression:
  id: rules_rule
  uuid: dddf688a-7849-4915-8b24-11f306e29950
  weight: 0
  conditions:
    id: rules_and
    uuid: 224ccce9-09cc-42e6-9d33-9fabbef6e22b
    weight: 0
    conditions: {  }
  actions:
    id: rules_action_set
    uuid: da81d7ca-11cb-4f3b-8f3e-3b654fe172f5
    weight: 0
    actions:
      -
        id: rules_action
        uuid: 284ca19a-6957-407d-a71d-d29675fcdb2a
        weight: 0
        context_values:
          item: testrole1
          unique: ''
          pos: end
        context_mapping:
          list: user.roles
        context_processors:
          item:
            rules_tokens: {  }
          unique:
            rules_tokens: {  }
          pos:
            rules_tokens: {  }
        provides_mapping: {  }
        action_id: rules_list_item_add

Логи:

TypeError: Argument 1 passed to Drupal\rules\Plugin\RulesAction\DataListItemAdd::doExecute() must be of the type array, object given в Drupal\rules\Plugin\RulesAction\DataListItemAdd->doExecute() (строка 58 из /home/elektr09/lk.elektroseti.com/docs/modules/rules/src/Plugin/RulesAction/DataListItemAdd.php)
#0 [internal function]: Drupal\rules\Plugin\RulesAction\DataListItemAdd->doExecute(Object(Drupal\Core\Field\EntityReferenceFieldItemList), '[testrole1]', '', 'end')
#1 /home/elektr09/lk.elektroseti.com/docs/modules/rules/src/Core/RulesActionBase.php(139): call_user_func_array(Array, Array)
#2 /home/elektr09/lk.elektroseti.com/docs/modules/rules/src/Plugin/RulesExpression/ActionExpression.php(111): Drupal\rules\Core\RulesActionBase->execute()
#3 /home/elektr09/lk.elektroseti.com/docs/modules/rules/src/Plugin/RulesExpression/ActionSetExpression.php(33): Drupal\rules\Plugin\RulesExpression\ActionExpression->executeWithState(Object(Drupal\rules\Context\ExecutionState))
#4 /home/elektr09/lk.elektroseti.com/docs/modules/rules/src/Plugin/RulesExpression/RuleExpression.php(121): Drupal\rules\Plugin\RulesExpression\ActionSetExpression->executeWithState(Object(Drupal\rules\Context\ExecutionState))
#5 /home/elektr09/lk.elektroseti.com/docs/modules/rules/src/Plugin/RulesExpression/ActionSetExpression.php(33): Drupal\rules\Plugin\RulesExpression\RuleExpression->executeWithState(Object(Drupal\rules\Context\ExecutionState))
#6 /home/elektr09/lk.elektroseti.com/docs/modules/rules/src/EventSubscriber/GenericEventSubscriber.php(147): Drupal\rules\Plugin\RulesExpression\ActionSetExpression->executeWithState(Object(Drupal\rules\Context\ExecutionState))
#7 [internal function]: Drupal\rules\EventSubscriber\GenericEventSubscriber->onRulesEvent(Object(Drupal\rules\Event\EntityEvent), 'rules_entity_in...', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#8 /home/elektr09/lk.elektroseti.com/docs/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func(Array, Object(Drupal\rules\Event\EntityEvent), 'rules_entity_in...', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#9 /home/elektr09/lk.elektroseti.com/docs/modules/rules/rules.module(167): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('rules_entity_in...', Object(Drupal\rules\Event\EntityEvent))
#10 [internal function]: rules_entity_insert(Object(Drupal\user\Entity\User))
#11 /home/elektr09/lk.elektroseti.com/docs/core/lib/Drupal/Core/Extension/ModuleHandler.php(403): call_user_func_array('rules_entity_in...', Array)
#12 /home/elektr09/lk.elektroseti.com/docs/core/lib/Drupal/Core/Entity/EntityStorageBase.php(206): Drupal\Core\Extension\ModuleHandler->invokeAll('entity_insert', Array)
#13 /home/elektr09/lk.elektroseti.com/docs/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(843): Drupal\Core\Entity\EntityStorageBase->invokeHook('insert', Object(Drupal\user\Entity\User))
#14 /home/elektr09/lk.elektroseti.com/docs/core/lib/Drupal/Core/Entity/EntityStorageBase.php(535): Drupal\Core\Entity\ContentEntityStorageBase->invokeHook('insert', Object(Drupal\user\Entity\User))
#15 /home/elektr09/lk.elektroseti.com/docs/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(728): Drupal\Core\Entity\EntityStorageBase->doPostSave(Object(Drupal\user\Entity\User), false)
#16 /home/elektr09/lk.elektroseti.com/docs/core/lib/Drupal/Core/Entity/EntityStorageBase.php(460): Drupal\Core\Entity\ContentEntityStorageBase->doPostSave(Object(Drupal\user\Entity\User), false)
#17 /home/elektr09/lk.elektroseti.com/docs/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(837): Drupal\Core\Entity\EntityStorageBase->save(Object(Drupal\user\Entity\User))
#18 /home/elektr09/lk.elektroseti.com/docs/core/lib/Drupal/Core/Entity/EntityBase.php(395): Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object(Drupal\user\Entity\User))
#19 /home/elektr09/lk.elektroseti.com/docs/core/modules/user/src/RegisterForm.php(101): Drupal\Core\Entity\EntityBase->save()
#20 [internal function]: Drupal\user\RegisterForm->save(Array, Object(Drupal\Core\Form\FormState))
#21 /home/elektr09/lk.elektroseti.com/docs/core/lib/Drupal/Core/Form/FormSubmitter.php(114): call_user_func_array(Array, Array)
#22 /home/elektr09/lk.elektroseti.com/docs/core/lib/Drupal/Core/Form/FormSubmitter.php(52): Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object(Drupal\Core\Form\FormState))
#23 /home/elektr09/lk.elektroseti.com/docs/core/lib/Drupal/Core/Form/FormBuilder.php(593): Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object(Drupal\Core\Form\FormState))
#24 /home/elektr09/lk.elektroseti.com/docs/core/lib/Drupal/Core/Form/FormBuilder.php(321): Drupal\Core\Form\FormBuilder->processForm('user_register_f...', Array, Object(Drupal\Core\Form\FormState))
#25 /home/elektr09/lk.elektroseti.com/docs/core/lib/Drupal/Core/Controller/FormController.php(91): Drupal\Core\Form\FormBuilder->buildForm(Object(Drupal\user\RegisterForm), Object(Drupal\Core\Form\FormState))
#26 [internal function]: Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch))
#27 /home/elektr09/lk.elektroseti.com/docs/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#28 /home/elektr09/lk.elektroseti.com/docs/core/lib/Drupal/Core/Render/Renderer.php(573): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#29 /home/elektr09/lk.elektroseti.com/docs/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#30 /home/elektr09/lk.elektroseti.com/docs/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#31 /home/elektr09/lk.elektroseti.com/docs/vendor/symfony/http-kernel/HttpKernel.php(151): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#32 /home/elektr09/lk.elektroseti.com/docs/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#33 /home/elektr09/lk.elektroseti.com/docs/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#34 /home/elektr09/lk.elektroseti.com/docs/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#35 /home/elektr09/lk.elektroseti.com/docs/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#36 /home/elektr09/lk.elektroseti.com/docs/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#37 /home/elektr09/lk.elektroseti.com/docs/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#38 /home/elektr09/lk.elektroseti.com/docs/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#39 /home/elektr09/lk.elektroseti.com/docs/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#40 /home/elektr09/lk.elektroseti.com/docs/core/lib/Drupal/Core/DrupalKernel.php(708): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#41 /home/elektr09/lk.elektroseti.com/docs/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#42 {main}
.

При конфигурировании придерживался этого гайда, но он устаревший, а другого и нет. https://www.drupal.org/node/1872384.