summaryrefslogtreecommitdiffstats
path: root/apps/workflowengine/lib/AppInfo
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2019-09-09 17:17:39 +0200
committerArthur Schiwon <blizzz@arthur-schiwon.de>2019-09-09 22:56:06 +0200
commitae1cc1d14dda99f62714d5e658e6cb71378aaae2 (patch)
treeef6251a499db11e4b3db7772f4d6ac5a3de6ed15 /apps/workflowengine/lib/AppInfo
parent849d025d093d1c80d3820901d20bf6a664c6af02 (diff)
downloadnextcloud-server-ae1cc1d14dda99f62714d5e658e6cb71378aaae2.tar.gz
nextcloud-server-ae1cc1d14dda99f62714d5e658e6cb71378aaae2.zip
entities equip the RuleMatcher on the events they are aware of
Operations will receive the matcher instance Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/workflowengine/lib/AppInfo')
-rw-r--r--apps/workflowengine/lib/AppInfo/Application.php11
1 files changed, 8 insertions, 3 deletions
diff --git a/apps/workflowengine/lib/AppInfo/Application.php b/apps/workflowengine/lib/AppInfo/Application.php
index e691c53d528..f5653a6e48c 100644
--- a/apps/workflowengine/lib/AppInfo/Application.php
+++ b/apps/workflowengine/lib/AppInfo/Application.php
@@ -24,6 +24,7 @@ namespace OCA\WorkflowEngine\AppInfo;
use OCA\WorkflowEngine\Manager;
use OCP\Template;
use OCA\WorkflowEngine\Controller\RequestTime;
+use OCP\WorkflowEngine\IEntity;
use OCP\WorkflowEngine\IOperation;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
@@ -83,13 +84,17 @@ class Application extends \OCP\AppFramework\App {
foreach ($configuredEvents as $operationClass => $events) {
foreach ($events as $entityClass => $eventNames) {
- array_map(function (string $eventName) use ($operationClass) {
+ array_map(function (string $eventName) use ($operationClass, $entityClass) {
$this->dispatcher->addListener(
$eventName,
- function (GenericEvent $event) use ($eventName, $operationClass) {
+ function (GenericEvent $event) use ($eventName, $operationClass, $entityClass) {
+ $ruleMatcher = $this->manager->getRuleMatcher();
+ /** @var IEntity $entity */
+ $entity = $this->getContainer()->query($entityClass);
+ $entity->prepareRuleMatcher($ruleMatcher, $eventName, $event);
/** @var IOperation $operation */
$operation = $this->getContainer()->query($operationClass);
- $operation->onEvent($eventName, $event);
+ $operation->onEvent($eventName, $event, $ruleMatcher);
}
);
}, $eventNames);