ABCDEFGHIJKLMNOPQRSTUVWXY
1
Current behaviourWith patch 18 (or 20)With alternative change
2
On saving context formOn triggering the ruleOn saving context formOn triggering the ruleOn saving context formOn triggering the rule
3
1. Action rules_send_email context name = Send to ContextDefinition = email DataDefinition dataType => list
4
node.uid.entity.mail
Saved ok
TypeError: Argument 1 passed to Drupal\rules\Plugin\RulesAction\
SystemSendEmail::doExecute() must be of the type array, object given
SameSame runtime error.Node.ui.entity.mail
Validation message "Expected a email data type for context Send to but got a list data type instead."

This is OK, as the correct selection is node.uid.entity.mail.value
Avoids the runtime error, which is an improvement.
5
node.uid.entity.mail.value
cannot be saved

"Expected a
list data type for context Send to but got a email data type instead. "
n/anode.uid.entity.mail.value can be saved ok

This is an improvement
Works – this is an improvement

get_class($typed_data) => \DataType\Email
$typed_data->getValue() => e-mail string
---matchTypedData---
$typed_data_data_type => email
$target_type => list
singlular value, so wrap in array
$typed_data->getValue() => Array
( [0] = the email address)
Same as with patch 18
6
2. Action rules_email_to_users_of_role. context name = Roles ContextDefinition = entity:user_role DataDefinition = list
7
node.uid.entity.roles

saves OK
TypeError: Argument 1 passed to Drupal\rules\Plugin\RulesAction\
SystemMailToUsersOfRole::doExecute() must be of the type
array, object given
SameSame error.Validation message "Expected a entity:user_role data type for context Roles but got a list data type instead".

This is less good. We want all the roles to be allowed
8
Node.ui.entity.roles.0

"Expected a list data type for context Roles but got a field_item:entity_reference data type instead"
n/aSamen/aExpected a entity:user_role data type for context Roles but got a field_item:entity_reference data type instead.
9
Node.ui.entity.roles.0.entity

Expected a list but got entity_reference
n/aSamen/aExpected a entity:user_role data type for context Roles but got a entity_reference data type instead.
10
Node.ui.entity.roles.0.target_id

Expected a list but got string
n/aSamen/aExpected a entity:user_role data type for context Roles but got a string data type instead.
11
3. Action rules_user_role_add context name = Roles ContextDefinition=entity:user_role DataDefinition => list
12
node.uid.entity.roles

Saves OK
Existing error:

TypeError: Argument 2 passed to
Drupal\rules\Plugin\
RulesAction\UserRoleAdd::doExecute()
must be of the type array, object given
SameSame runtime error even though new code changed the value to array

$typed_data->getName() => roles
get_class($typed_data) => Drupal\Core\Field\EntityReferenceFieldItemList

---matchTypedData---
$typed_data_data_type => list
$target_type => list
already ok, return

===RulesActionBase::execute()==
$name => roles
$this->getContextValue($name) returns
object for 'roles' so $args gets object not array, then fails
Node.uid.entity.roles

Cannot be saved

Expected a
entity:user_role data type for context Roles but got a list data type instead.

NOT an improvement
n/a
13
node.uid.entity.roles.0
"Expected a list data type for context Roles but got a field_item:entity_reference data type instead.
n/aSamen/aSame
Expected a entity:user_role data type for context Roles but got a field_item:entity_reference data type instead.
14
node.uid.entity.roles.0.target_id
"Expected a list data type for context Roles but got a string data type instead"
n/aSamen/aExpected a entity:user_role data type for context Roles but got a string data type instead.
15
4. Action rules_user_role_remove Context name = Roles ContextDefinition=entity:user_role DataDefinition => list
16
node.uid.entity.roles

saves OK
TypeError: Argument 2 passed to Drupal\rules\Plugin\ RulesAction\ UserRoleRemove::doExecute() must be of the type array, object givenSameSame error.

This is the same as User Role Add
Same as User Role Add

Node.uid.entity.roles Cannot be saved
"Expected a entity:user_role data type for context Roles but got a list data type instead"

NOT an improvement
17
node.uid.entity.roles.0
node.uid.entity.roles.0.entity
node.uid.entity.roles.0.target_id
cannot save
Expected a list data type for context Roles but got a field_item:entity_reference / string data type instead.
n/aSamen/a
18
5. Condition rules_user_has_role context name = Roles ContextDefinition = entity:user_role DataDefinition = list
19
Node.uid.entity.roles
Saves OK
TypeError: Argument 2 passed to Drupal\rules\Plugin\Condition\UserHasRole::doEvaluate() must be of the type array, object givenSameSame errorSave is prevented, with message "Expected a entity:user_role data type for context Roles but got a list data type instead."
However, we may want to save entity.roles, then fix the trigger
n/a
20
Node.uid.entity.roles.0
Node.uid.entity.Roles.0.target_id

Expected a list data type for context Roles but got a {field_item:entity_reference / string} instead.
n/aSamen/aSamen/a
21
6. Condition rules_node_is_of_type context name = Types ContextDefinition = string DataDefinition = list
22
Node.type

Saves ok
TypeError: Argument 2 passed to Drupal\rules\Plugin\Condition\NodeIsOfType::doEvaluate() must be of the type array, object givenSameSame errorSave is prevented with "Expected a string data type for context Content types but got a list data type instead. "
23
Node.type.target_id
Cannot save
"Expected a list data type for context Content types but got a string data type instead."
n/aNode.type.target_id

Can save OK. This is an improvement
Works correctlySame, saves OKSame, works correctly
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100