Needs work
Project:
Rules
Version:
7.x-2.x-dev
Component:
Rules Core
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
4 Jul 2012 at 23:00 UTC
Updated:
2 Apr 2014 at 12:51 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
zhangtaihao commentedCorrected issue title.
Also, it would seem much more reasonable to use
'embeddable'from$this->pluginInfo()to check for compatibility. Opinions?Comment #2
zhangtaihao commentedChanged issue status.
Comment #3
zhangtaihao commentedOkay, that hasn't worked.
Comment #4
zhangtaihao commentedOkay the problem with using 'embeddable' is that RulesEventSet extends from RulesRuleSet and uses RulesRuleSet::rule() to add a rule, which adds it as an action, which in turns tries to call setParent().
My personal judgment says 'reaction rule' should be embeddable in 'event set'.
Comment #5
zhangtaihao commentedAll tests pass on my server.
Comment #6
mitchell commentedTested adding an action to a conditional with #1:
Hmm. I found the relationship between making RulesPlugin throw an error if you try to apply an invalid parent plugin setting along with RulesContainerPluginUI making options like these unavailable in the UI to be very interesting. These seem almost like implied behaviors, whereas it could be possible to integrate the concepts in a deeper way and expose this functionality through Rules' API and UI API with more reused functionality. Could an abstract plugin instances' declared embeddables be reflected in entity_info and these patches be based on that?
What about adding a property to Rules Configurations to represent the embeddables provided to RulesAbstractPluginDefaults? Perhaps, both patches could also be reworked similar to what I said above, and then another could rework checkParameterSettings()? This is getting significantly above my head now. But wow, that
//TODO: Make sure used values are allowed. (key/value pairs + allowed values)almost matches excatly!I'll reply to #4 separately.
Edited slightly.
Comment #7
mitchell commented> My personal judgment says 'reaction rule' should be embeddable in 'event set'.
This seems like a perfect match to the topic in #841336: [Meta] Interchange with other rules languages by aligning concepts.
Edit: And I think it should be a separate issue.
Comment #8
zhangtaihao commentedI am unsure as to what you meant about #1666802-25: Keep embedded elements under compatible containers in container UI being unnecessary. That change was to prevent the row to add "stuff" to actions from being considered draggable, basically because the operations row isn't in a table footer. EDIT: But, yes, you're right, it should become unnecessary once the bugs are fixed.
Regarding further integrating the concepts between the engine and the UI, I would beg to differ. There should be minimal coupling between plugin and UI via Faces. Plugins are meant to drive functionality. Configuration is represented as entities. This is for the purpose of consistency and (again) loose coupling between data, functionality and user interface (much like the MVC concept). Thus, entity_info and plugin_info serve entirely different purposes. This separation of concerns is also evident in Drupal 8 Plugin architecture.
The reason in the patch I'm using the 'embeddable' declaration from the plugin info to test for compatible containers is that the alternative was to declare a redundant method (e.g.
getCompatibleContainer()). Additionally, the only reason the UI also uses 'embeddable' from plugin info should be to complement the conceptual hierarchy in the plugin controllers, not the other way around.Also, parent isn't something to go into the rules_config entity, basically because a rules_config entity has no parent (i.e.
RulesPlugin::isRoot() == TRUE). That certain configurations have children is merely a quality of the container plugin sub-concept.Finally, as you suggested, I have added an issue for #4:
#1672444: carify the UI-only use of the embeddable key
Comment #9
mitchell commented> I am unsure as to what you meant about #1666802-25: Keep embedded elements under compatible containers in container UI being unnecessary.
Oh, I see how my words came out now. I meant to say that testing #25 with this patch isn't necessary, because it prevents this error from occurring. That's all.
Comment #10
zhangtaihao commentedCool.
I was just about to suggest that getting setParent() right is also to play nice with code-level manipulation.
Comment #11
zhangtaihao commentedThere is an additional problem with the existing setParent() code: when using
==to check if the given parent is already current, PHP triggers the error message "Fatal error: Nesting level too deep - recursive dependency?" on the line that does the comparison. Presumably somehow the child's and parent's references to each other trigger the recursive check. To fix the issue, the comparison operator needs to be changed to===.This symptom can be reproduced using the import from #1666802-21: Keep embedded elements under compatible containers in container UI.
Rerolled patch from #1 with the minor change.
Comment #12
zhangtaihao commentedAlso worth pointing out that this issue now effectively depends on #1672444: carify the UI-only use of the embeddable key.
Comment #13
zhangtaihao commentedSame thing as #11 happens when trying to drag a tree into another embeddable.
You can test using the attached action set. Try to drag the "(Else) If" from one conditional to another and save.
This patch is the same as #1 with the additional
$strictargument forarray_search()passed as TRUE. This is effectively the same change as #11, just for PHP internals.Comment #14
zhangtaihao commentedI've temporarily updated Conditional Rules to match this change.
Comment #15
zhangtaihao commentedChanging issue status.
Comment #16
klausiunrelated change?
But otherwise I think this makes sense, we should definitively replace those hard-coded Action/Condition classes and interfaces. Marking as RTBC, but leaving for fago as he knows this one better than me.
Comment #17
fagoouch. yep let's fix that, however the patch does much more than that.
As klausi said, unrelated. Also I don't think we should do that, as the UI might treat with some serialized and unserialized configs.
Embeddable is supposed to be an UI-helper-flag, whereas the API only limits embedding things to the interfaces.
Any reasons why we should change that?
Comment #18
fagoExactly, I doubt this would work. So why was that RTBC?
Comment #19
zhangtaihao commentedComparing
$this->parent==$parentcauses two objects each with potential circular references to be compared for all attributes, causing a PHP recursive loop. Of course, I can create that as a separate issue.What did you mean by "some serialized, some unserialized"?
Comment #19.0
zhangtaihao commentedCorrected name.
Comment #20
fagoYes, please. As said I'm hesitate of doing so as I fear it might break the UI - see below.
During editing Rules in the UI configurations get serialized, while others get loaded. So one might end up having two different objects of the same configuration instantiated. I guess, taking the passed parent would be the right thing to do in any case - but it needs solid testing to make sure nothing breaks.