Skip to content

Instantly share code, notes, and snippets.

@fago
Created February 8, 2015 13:58
Show Gist options
  • Select an option

  • Save fago/77e6ad6744b9620eb9eb to your computer and use it in GitHub Desktop.

Select an option

Save fago/77e6ad6744b9620eb9eb to your computer and use it in GitHub Desktop.
create rule with context:
<?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();
@fago
Copy link
Author

fago commented Feb 12, 2015

Environment
ExpressionEnvironment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment