Created
February 8, 2015 13:58
-
-
Save fago/77e6ad6744b9620eb9eb to your computer and use it in GitHub Desktop.
create rule with context:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $rule = $this->expressionManager->createRule([ | |
| 'context_definitions' => [ | |
| 'test' => [ | |
| 'type' => 'string', | |
| 'label' => 'Test string', | |
| ], | |
| ], | |
| ]); | |
| $rule->addCondition('rules_test_string_condition', [ | |
| 'context_mapping' => ['text:select' => 'test'], | |
| ]); | |
| $rule->addAction('rules_test_log'); | |
| $rule->setContextValue('test', 'test value'); | |
| $rule->execute(); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Environment
ExpressionEnvironment