Browse Source

workflow update

Luciano Andrade 7 năm trước cách đây
mục cha
commit
0488568ff2
2 tập tin đã thay đổi với 22 bổ sung5 xóa
  1. 14 3
      Event/EventSubscriber.php
  2. 8 2
      composer.json

+ 14 - 3
Event/EventSubscriber.php

@@ -101,8 +101,19 @@ class EventSubscriber implements EventSubscriberInterface
         $objectClass = (string) get_class($object);
         $logger->info("EVENT {$eventName}:{$eventReference} => {$objectClass }_id_{$object->getId()}");
 
-        $actions = $em->getRepository("WorkflowBundle:Action")
-                ->findAllByEventAndWorkflowName($eventName, $object->getWorkflowName(), $eventReference, $objectClass);
+       $criteria = array("workflowName" => $event->getWorkflowName(), "eventReference" => $eventReference
+       );
+        $actions = $em->getRepository("WorkflowBundle:Action")->findBy($criteria);
+
+       $new_actions = array();
+       foreach($actions as $action){
+
+               if(in_array($eventName, $action->getEvent()) AND is_a($object, $action->getObjectClass())){
+                       $new_actions[] = $action;
+               }       
+       }
+       $actions = $new_actions;
+        $logger->info("EVENT Found ". count($actions) . " actions to apply", $criteria);
 
         return $actions;
     }
@@ -131,4 +142,4 @@ class EventSubscriber implements EventSubscriberInterface
         // file_put_contents("/var/flowdat/ftth/out.log", $string);
     }
 
-}
+}

+ 8 - 2
composer.json

@@ -2,8 +2,14 @@
     "name": "ik/workflow-bundle",
     "description": "Flowdat 3 Workflow Bundle",
     "keywords": ["workflow", "bundle"],
+    "repositories":{
+	{ "type": "vcs",
+          "url": "git@github.com:symfony/workflow"
+	}
+    },
     "require": {
-        "php-amqplib/rabbitmq-bundle": "^1.12"
+        "php-amqplib/rabbitmq-bundle": "^1.12",
+        "symfony/workflow": "^3.3"
     },
     "autoload": {
         "psr-4": { "WorkflowBundle\\": "" }
@@ -24,4 +30,4 @@
     },
     "version": "1.0",
     "minimum-stability": "stable"
-}
+}