-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change reaction-rule config to save the event with settings #405
base: 8.x-3.x
Are you sure you want to change the base?
Conversation
event: | ||
type: string | ||
label: 'Event' | ||
events: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unrelated, this seems wrong / outdated. Probably we can remove rules_expression.rules_reaction_rule - the plugin does not exist any more afair.
* The events array. The array is numerically indexed and contains arrays | ||
* with the following structure: | ||
* - event_name: string with the event machine name. | ||
* - configuration: an array containing the event configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description sentences should start upper-case
*/ | ||
protected $event; | ||
protected $events; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should initialize this as empty array with "[]".
Conflicts: src/Engine/RulesComponent.php src/Form/ReactionRuleEditForm.php
* Events array. The array is numerically indexed and contains arrays with the | ||
* following structure: | ||
* - event_name: String with the event machine name. | ||
* - configuration: An array containing the event configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a code smell if we need to document array keys. I think we should use a simple class instead which has this properties + methods documented. We should prevent nested array weirdness when we can.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, but can we do that with CMI? I've only seen it save/load arrays.
As alternative, we could use an order array with
$event_name => $configuration
which Alex tried initially. Problem there was that we need to have dots in event names (as symfony events use dots), but CMI does not allow dots in config keys. Thus, we'd have to massage the event names and somehow escape/replace dots. That makes it more complicated, also when querying for events etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can file a follow-up to explore using objects instead of event arrays.
Conflicts: src/Entity/ReactionRuleStorage.php src/Form/ReactionRuleEditForm.php tests/src/Kernel/EventIntegrationTest.php
Conflicts: config/schema/rules.schema.yml
https://www.drupal.org/node/2666200