Skip to content
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

Open
wants to merge 11 commits into
base: 8.x-3.x
Choose a base branch
from

Conversation

milkovsky
Copy link
Contributor

event:
type: string
label: 'Event'
events:
Copy link
Owner

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.
Copy link
Owner

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;
Copy link
Collaborator

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 "[]".

* 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.
Copy link
Collaborator

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.

Copy link
Owner

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.

Copy link
Collaborator

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants